larroy commented on a change in pull request #14192: [MXNET-1324] Add
NaiveRunGraph to imperative utils
URL: https://github.com/apache/incubator-mxnet/pull/14192#discussion_r293491646
##########
File path: src/imperative/imperative_utils.cc
##########
@@ -22,6 +22,106 @@
namespace mxnet {
namespace imperative {
+
+inline std::vector<NDArray*> NodeInputs(const nnvm::IndexedGraph& idx,
+ const int node_idx,
+ const std::vector<NDArray*> arrays) {
+ const nnvm::IndexedGraph::Node& node = idx[node_idx];
+ const size_t num_inputs = node.inputs.size();
+ std::vector<NDArray*> ndinputs;
+ ndinputs.reserve(num_inputs);
+ for (const auto& j : node.inputs) {
+ size_t eid = idx.entry_id(j);
+ ndinputs.emplace_back(arrays[eid]);
+ }
+ return ndinputs;
+}
+
+inline std::vector<NDArray*> NodeOutputs(const nnvm::IndexedGraph& idx,
Review comment:
Why inline?
----------------------------------------------------------------
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