@@ -20,7 +20,7 @@ struct VariableParam {
20
20
21
21
NodePtr CreateVariableNode (const std::string& name) {
22
22
NodePtr n = Node::Create ();
23
- n->op = nullptr ;
23
+ n->attrs . op = nullptr ;
24
24
n->attrs .name = name;
25
25
n->attrs .parsed = VariableParam ();
26
26
return n;
@@ -37,8 +37,8 @@ inline void UpdateNodeVersion(Node *n) {
37
37
e.version = nnvm::get<VariableParam>(e.node ->attrs .parsed ).version ;
38
38
}
39
39
}
40
- if (fmutate_inputs.count (n->op ) != 0 ) {
41
- for (uint32_t i : fmutate_inputs[n->op ](n->attrs )) {
40
+ if (fmutate_inputs.count (n->op () ) != 0 ) {
41
+ for (uint32_t i : fmutate_inputs[n->op () ](n->attrs )) {
42
42
NodeEntry& e = n->inputs [i];
43
43
CHECK (e.node ->is_variable ())
44
44
<< " Mutation target can only be Variable" ;
@@ -96,7 +96,6 @@ Symbol Symbol::Copy() const {
96
96
// use DFSVisit to copy all the nodes
97
97
DFSVisit (this ->outputs , [&old_new](const NodePtr& node) {
98
98
NodePtr np = Node::Create ();
99
- np->op = node->op ;
100
99
np->attrs = node->attrs ;
101
100
old_new[node.get ()] = std::move (np);
102
101
});
@@ -123,7 +122,7 @@ void Symbol::Print(std::ostream &os) const {
123
122
if (outputs[0 ].node ->is_variable ()) {
124
123
os << " Variable:" << outputs[0 ].node ->attrs .name << ' \n ' ;
125
124
} else {
126
- os << " AtomicFunctor " << " Op:" << outputs[0 ].node ->op ->name << ' \n ' ;
125
+ os << " AtomicFunctor " << " Op:" << outputs[0 ].node ->op () ->name << ' \n ' ;
127
126
}
128
127
} else {
129
128
// use DFSVisit to copy all the nodes
@@ -137,7 +136,7 @@ void Symbol::Print(std::ostream &os) const {
137
136
os << " Variable:" << node->attrs .name << ' \n ' ;
138
137
} else {
139
138
os << " --------------------\n " ;
140
- os << " Op:" << node->op ->name << " , Name=" << node->attrs .name << ' \n '
139
+ os << " Op:" << node->op () ->name << " , Name=" << node->attrs .name << ' \n '
141
140
<< " Inputs:\n " ;
142
141
for (size_t i = 0 ; i < node->inputs .size (); ++i) {
143
142
const NodeEntry& e = node->inputs [i];
@@ -196,8 +195,8 @@ std::vector<std::string> Symbol::ListInputNames(ListInputOption option) const {
196
195
DFSVisit (this ->outputs , [&ret, &mutable_set, &vlist](const NodePtr &node) {
197
196
if (node->is_variable ()) {
198
197
vlist.push_back (node.get ());
199
- } else if (fmutate_inputs.count (node->op )) {
200
- for (uint32_t i : fmutate_inputs[node->op ](node->attrs )){
198
+ } else if (fmutate_inputs.count (node->op () )) {
199
+ for (uint32_t i : fmutate_inputs[node->op () ](node->attrs )){
201
200
mutable_set.insert (node->inputs [i].node .get ());
202
201
}
203
202
}
@@ -221,7 +220,7 @@ std::vector<std::string> Symbol::ListOutputNames() const {
221
220
} else {
222
221
const std::string& hname = head.node ->attrs .name ;
223
222
std::string rname;
224
- FListOutputNames fn = flist_ouputs.get (head.node ->op , nullptr );
223
+ FListOutputNames fn = flist_ouputs.get (head.node ->op () , nullptr );
225
224
if (fn != nullptr ) {
226
225
rname = fn (head.node ->attrs )[head.index ];
227
226
} else {
@@ -278,10 +277,10 @@ void Symbol::Compose(const array_view<const Symbol*>& args,
278
277
}
279
278
// switch to keyword argument matching
280
279
if (args.size () != n_req) {
281
- FListInputNames fn = flist_inputs.get (n->op , nullptr );
280
+ FListInputNames fn = flist_inputs.get (n->op () , nullptr );
282
281
auto arg_names = (fn == nullptr ) ? std::vector<std::string>{" data" } : fn (n->attrs );
283
282
if (arg_names.size () != n_req) {
284
- LOG (FATAL) << " Not enough argument to call operator " << outputs[0 ].node ->op ->name ;
283
+ LOG (FATAL) << " Not enough argument to call operator " << outputs[0 ].node ->op () ->name ;
285
284
}
286
285
size_t nmatched = 0 ;
287
286
for (size_t i = args.size (); i < n_req; ++i) {
@@ -422,8 +421,8 @@ void Symbol::SetAttrs(const std::vector<std::pair<std::string, std::string> >& a
422
421
node->attrs .dict [kv.first ] = kv.second ;
423
422
}
424
423
}
425
- if (node->op != nullptr && node->op ->attr_parser != nullptr ) {
426
- node->op ->attr_parser (&(node->attrs ));
424
+ if (node->op () != nullptr && node->op () ->attr_parser != nullptr ) {
425
+ node->op () ->attr_parser (&(node->attrs ));
427
426
}
428
427
}
429
428
@@ -461,10 +460,10 @@ Symbol Symbol::CreateFunctor(const Op* op,
461
460
std::unordered_map<std::string, std::string> attrs) {
462
461
Symbol s;
463
462
NodePtr n = Node::Create ();
464
- n->op = op;
463
+ n->attrs . op = op;
465
464
n->attrs .dict = std::move (attrs);
466
- if (n->op ->attr_parser != nullptr ) {
467
- n->op ->attr_parser (&(n->attrs ));
465
+ if (n->op () ->attr_parser != nullptr ) {
466
+ n->op () ->attr_parser (&(n->attrs ));
468
467
}
469
468
s.outputs .emplace_back (NodeEntry{std::move (n), 0 , 0 });
470
469
return s;
0 commit comments