mseth10 commented on a change in pull request #17194: Enhancements for custom 
subgraph op
URL: https://github.com/apache/incubator-mxnet/pull/17194#discussion_r362148435
 
 

 ##########
 File path: src/c_api/c_api.cc
 ##########
 @@ -646,10 +654,28 @@ int MXLoadLib(const char *path) {
       // TODO(samskalicky): enable constant overwriting of registertion 
multiple times
       plevel++;
     }
-    regOp.set_attr<nnvm::FInferType>("FInferType", infer_type, plevel);
-    regOp.set_attr<mxnet::FInferShape>("FInferShape", infer_shape, plevel);
-    regOp.set_attr<FInferStorageType>("FInferStorageType", infer_storage_type, 
plevel);
-    regOp.set_attr<FResourceRequest>("FResourceRequest", resc_req, plevel);
+    if (!isSubgraphOp) {
+      regOp.set_attr<nnvm::FInferType>("FInferType", infer_type, plevel);
+      regOp.set_attr<mxnet::FInferShape>("FInferShape", infer_shape, plevel);
+      regOp.set_attr<FInferStorageType>("FInferStorageType", 
infer_storage_type, plevel);
+      regOp.set_attr<FResourceRequest>("FResourceRequest", resc_req, plevel);
+      // optionally add fmutate inputs if user specified a function
+      if (mutate_fp != nullptr)
+        regOp.set_attr<nnvm::FMutateInputs>("FMutateInputs", mutate_inputs, 
plevel);
+    } else {
+      using namespace mxnet::op;
+      regOp.set_attr<nnvm::FInferType>("FInferType",
+                                       DefaultSubgraphOpType, plevel);
+      regOp.set_attr<mxnet::FInferShape>("FInferShape",
+                                         DefaultSubgraphOpShape, plevel);
+      regOp.set_attr<FInferStorageType>("FInferStorageType",
+                                        DefaultSubgraphOpStorageType, plevel);
+      regOp.set_attr<FResourceRequest>("FResourceRequest",
+                                       DefaultSubgraphOpResourceRequest, 
plevel);
+      regOp.set_attr<nnvm::FMutateInputs>("FMutateInputs",
 
 Review comment:
   should we check `if (mutate_fp != nullptr)` here?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to