larroy commented on a change in pull request #14836: Refactor AGInfo and
Imperative
URL: https://github.com/apache/incubator-mxnet/pull/14836#discussion_r305139734
##########
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:
This is the old SOA vs AOS dilema, in general is less efficient to do AOS.
https://www.youtube.com/watch?v=Dj3lkfIEUyA
This is well known in gaming circles, as you loose quite a bit of cache
efficiency due to AoS.
I don't see a real benefit of having a single array 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