apeforest commented on a change in pull request #14836: Refactor AGInfo and 
Imperative
URL: https://github.com/apache/incubator-mxnet/pull/14836#discussion_r305025800
 
 

 ##########
 File path: src/imperative/imperative.cc
 ##########
 @@ -316,181 +312,223 @@ std::vector<NDArray*> Imperative::Backward(
       info.outputs.back() = static_cast<real_t>(1.0);
     }
   }
+  return ograd_entries;
+}
 
-  // Get gradient graph
-  Symbol sym;
-  sym.outputs = graph.outputs;
-  std::vector<NodeEntry> xs;
-  std::vector<NDArray*> x_grads;
-  std::vector<OpReqType> x_reqs;
-  if (variables.size()) {
-    xs.reserve(variables.size());
-    x_grads.reserve(variables.size());
-    x_reqs.reserve(variables.size());
+struct Imperative::GradientVariableNodes {
 
 Review comment:
   Since these vector will always have the same size, would it make sense to 
create a struct like the following:
   ```suggestion
   struct Imperative::GradientVariableNode {
        nnvm::NodeEntry variable_node;
        NDArray *gradient
        OpReqType op_req_type 
   ```
   and return a vector of this structure from `CreateGradientVariableNodes` 
function?

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