huajsj commented on a change in pull request #9108:
URL: https://github.com/apache/tvm/pull/9108#discussion_r725196088
##########
File path: python/tvm/contrib/pipeline_executor.py
##########
@@ -70,24 +71,72 @@ def build(pipe_configs):
)
mconf["dev"] = "{},{}".format(dev.device_type, dev.device_id)
- # Create a pipeline configuration.
+ # Create a pipeline configuration, 'mod_idx' start from 0.
string_config[mod_idx] = mconf
- mods[mod] = {"dev": dev}
+ libs[mod_idx] = {"lib": lib, "dev": dev}
- return PipelineExecutorFactoryModule(mods, string_config)
+ return PipelineExecutorFactoryModule(libs, string_config)
class PipelineModule(object):
"""Wrapper of runtime module, caller can use this module to set parameters
and get outputs.
Parameters
----------
- module : PipelineExecutorFactoryModule
- Common interface for pipeline executor factory modules.
+ module : PipelineExecutorFactoryModule/Module
+ Common interface for pipeline executor factory modules or Module.
"""
def __init__(self, module):
- self.module = module.module
+ if isinstance(module, PipelineExecutorFactoryModule):
+ self.module = module.module
+ else:
+ self.module = module
+ # Get the packed functions from the pipeline executor.
+ self._get_num_outputs = self.module["get_num_outputs"]
+
+ @property
+ def num_outputs(self):
+ """Get the number of outputs.
+ Returns
+ -------
+ count : int
+ The number of outputs.
+ """
+ return self._get_num_outputs()
+
+ @staticmethod
+ def load_library(config_file_name):
+ """Import files to create a pipeline executor.
+
+ Parameters
+ ----------
+ config_file_name : str
+ Path and name of the configuration file, the configuration file
contains the
+ disk path of the parameter file, library file, and JSON file.
+ """
+ config = ""
Review comment:
fixed.
--
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]