mehrdadh commented on a change in pull request #7903:
URL: https://github.com/apache/tvm/pull/7903#discussion_r619411388



##########
File path: src/runtime/graph_executor/debug/graph_executor_debug.cc
##########
@@ -208,25 +201,74 @@ class GraphExecutorDebug : public GraphExecutor {
   }
 
   /*!
-   * \brief Copy index-th node to data_out.
+   * \brief Get number of outputs of the node.
+   * \param index The index of the node.
+   * \return The number of outputs.
+   */
+  size_t NodeGetNumOutputs(size_t index) {
+    if (nodes_[index].op_type != "tvm_op") return 1;
+    return static_cast<size_t>(nodes_[index].param.num_outputs);
+  }
+
+  /*!
+   * \brief Execute network to a specific node and return result.
    *
    * This method will do a partial run of the the graph
    * from begining upto the index-th node and return output of index-th node.
    * This is costly operation and suggest to use only for debug porpose.
    *
-   * \param index: The  index of the node.
-   * \param data_out the node data.
+   * \param index: The index of the node.
+   * \return Node output array.
    */
-  void DebugGetNodeOutput(int index, DLTensor* data_out) {
+  Array<NDArray> DebugGetNodeOutput(int index) {
     ICHECK_LT(static_cast<size_t>(index), op_execs_.size());
-    uint32_t eid = index;
+    Array<NDArray> results;
 
-    for (size_t i = 0; i < op_execs_.size(); ++i) {
+    for (size_t i = 0; i <= static_cast<size_t>(index); i++) {
       if (op_execs_[i]) op_execs_[i]();
-      if (static_cast<int>(i) == index) break;
     }
+    for (size_t j = 0; j < NodeGetNumOutputs(index); j++) {
+      results.push_back(data_entry_[entry_id(index, j)].CopyTo({kDLCPU, 0}));
+    }
+    return results;
+  }
+
+  /*!
+   * \brief Execute next node in the network.
+   *
+   * This method will execute next node assuming
+   * previous nodes has been executed and return output of index-th node.
+   *
+   * \param index: The index of the node.
+   * \param eid The Entry id of the op.

Review comment:
       how do you suggest to separate it?
   I think this API actually aligns with the first goal. Because it only 
transfers one output at a time.




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


Reply via email to