huajsj commented on a change in pull request #9494:
URL: https://github.com/apache/tvm/pull/9494#discussion_r747997748



##########
File path: python/tvm/contrib/pipeline_executor.py
##########
@@ -93,8 +108,71 @@ def __init__(self, module):
         else:
             self.module = module
         # Get the packed functions from the pipeline executor.
+        self._run = self.module["run"]
+        self._stop = self.module["stop"]
+        self._set_input = self.module["set_input"]
+        self._set_param = self.module["set_param"]
+        self._get_input = self.module["get_input"]
+        self._get_output = self.module["get_output"]
+        self._get_num_inputs = self.module["get_num_inputs"]
         self._get_num_outputs = self.module["get_num_outputs"]
 
+    def run(self, sync=False):
+        """Run the pipeline executor."""
+        self._run(sync)
+
+    def stop(self):
+        """Stop the pipeline executor."""
+        self._stop()
+
+    def set_input(self, key, value):
+        """Set inputs to the module via "value".
+        Parameters
+        ----------
+        key : str
+            The input key
+
+        value : array_like.
+            The input value
+        """
+        self._set_input(key, tvm.nd.array(value, tvm.cpu()))
+
+    def set_params(self, params_name, params_data):
+        """Set params to the module via param name and params data.
+        Parameters
+        ----------
+        params_name : str
+            The params name
+
+        params_data : dict of str to NDArray
+            A list of params data and params key name.
+        """
+        if params_data:
+            keys = list(params_data.keys())
+            keys.sort(key=lambda x: -np.prod(params_data[x].shape))
+            for k in keys:
+                self._set_param(params_name, k, tvm.nd.array(params_data[k], 
tvm.cpu()))

Review comment:
       this logic is the same logic used in graph_executor.py that use such 
logic to handle "a rpc memory issue", I assume such issue already fixed, then 
just remove 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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to