elvin-nnov commented on a change in pull request #7903:
URL: https://github.com/apache/tvm/pull/7903#discussion_r618237281



##########
File path: src/runtime/graph_executor/debug/graph_executor_debug.cc
##########
@@ -229,6 +229,28 @@ class GraphExecutorDebug : public GraphExecutor {
     data_entry_[eid].CopyTo(data_out);
   }
 
+  /*!
+   * \brief Run debugger 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 eid The Entry id of the op.
+   * \return Node output array.
+   */
+  NDArray RunLayerGetOutput(int index, int eid) {
+    ICHECK_LT(static_cast<size_t>(index), op_execs_.size());
+
+    for (size_t i = 0; i < op_execs_.size(); ++i) {
+      if (op_execs_[i]) op_execs_[i]();
+      if (static_cast<int>(i) == index) break;

Review comment:
       why not to move this condition to above for() statement? like
   ``` for (size_t i = 0; i < (index < op_execs_.size()) ? index : 
op_execs_.size(); ++i)```




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