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



##########
File path: python/tvm/contrib/debugger/debug_executor.py
##########
@@ -170,22 +173,74 @@ def _create_debug_env(self, graph_json, device):
         # init the debug dumping environment
         self.debug_datum = debug_result.DebugResult(graph_json, 
self._dump_path)
 
+    def _execute_next_node(self, node_index, entry_id):
+        """Execute node assuming all previous nodes has been executed.
+        Return the output of this node.
+
+        Parameters
+        ----------
+        node_index : int
+            The node index
+
+        entry_id : int
+            The entry id.
+        """
+        out_tensor = self._execute_next_node_get_output(node_index, entry_id)
+        return array(out_tensor)
+
+    def _run_per_layer(self):
+        """Execute up to each node and each debug output will be
+        copied to the buffer.
+
+        """
+        for i, node in enumerate(self.debug_datum.get_graph_nodes()):
+            num_outputs = self.debug_datum.get_graph_node_output_num(node)
+            for j in range(num_outputs):
+                logging.info("running: output=%d of node_name: %s", j, 
node["name"])
+                out_tensor = self._execute_next_node(i, j)
+                self.debug_datum._output_tensor_list.append(out_tensor)
+
+    def execute_node(self, node_name):
+        """Execute network up to this node.
+        Return the outputs of this node.
+
+        Parameters
+        ----------
+        node_index : str
+            The node name
+        """
+        node_index = None
+        selected_node = None
+        for i, node in enumerate(self.debug_datum.get_graph_nodes()):
+            if node["name"] == node_name:
+                selected_node = node
+                node_index = i
+                break
+        if not node_index:
+            raise AttributeError("Node name is not valid.")
+
+        num_outputs = self.debug_datum.get_graph_node_output_num(selected_node)
+        output_tensors = []
+        for j in range(num_outputs):
+            out = self._execute_node_get_output(node_index, j)
+            out = array(out)

Review comment:
       removed it!




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