tvm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [tvm] elvin-nnov commented on a change in pull request #7903: [Graph Executor Debugger] fix parameter dump and introduce two debugging modes
Date Thu, 22 Apr 2021 09:40:39 GMT

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:
users@infra.apache.org



Mime
View raw message