samskalicky commented on a change in pull request #17623: Dynamic subgraph 
compile support
URL: https://github.com/apache/incubator-mxnet/pull/17623#discussion_r384247611
 
 

 ##########
 File path: example/extensions/lib_subgraph/subgraph_lib.cc
 ##########
 @@ -218,10 +218,27 @@ MXReturnValue mySupportedOps(std::string json,
 
 MXReturnValue myReviewSubgraph(std::string json, int subraph_id, bool* accept,
                                std::unordered_map<std::string, std::string>& 
options,
-                               std::unordered_map<std::string, std::string>& 
attrs) {
+                               std::unordered_map<std::string, std::string>& 
attrs,
+                               std::map<std::string, MXTensor>& args,
+                               std::map<std::string, MXTensor>& aux) {
   for (auto kv : options) {
     std::cout << "option: " << kv.first << " ==> " << kv.second << std::endl;
   }
+  for (auto kv : args) {
+    std::cout << "arg: " << kv.first << " ==> (";
+    for (auto s : kv.second.shape)
+      std::cout << s << ",";
+    std::cout << ") [";
+    for (int i=0; i<kv.second.size(); i++)
+      std::cout << kv.second.data<float>()[i] << ", ";
+    std::cout << "]" << std::endl;
+  }
+  if(options.count("reqArgs") > 0 && args.size() == 0) {
 
 Review comment:
   this is just an example implementation of the subgraph library. it can do 
whatever the user wants it to do. the `options` map contains whatever the user 
passes to the `optimize_for` APIs. Its purely a pass through from the user to 
the backend 
   
   Theres no reason to require aux by default, depending on the model it may or 
may not have any aux params. The smarter thing a user could do is check and see 
if the subgraph has aux inputs, and then in the aux map is empty error out. But 
again this is just an example subgraph library. Not the one that everyone must 
use as-is, unmodified. 

----------------------------------------------------------------
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