Skip to content

Commit 2f06922

Browse files
committed
[microTVM] Add wrapper for creating project using a MLF
Currently there is already a wrapper function for creating a new project directory based on an ExportableModule, but there isn't one for creating a new project directory based on an existing MLF archive, which is also handy. Hence that commit adds a new wrapper for creating a project using an existing model compiled and kept in a MLF archive. Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
1 parent 98eab45 commit 2f06922

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

python/tvm/micro/project.py

+33
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,36 @@ def generate_project(
154154
"""
155155
template = TemplateProject.from_directory(str(template_project_dir))
156156
return template.generate_project(module, str(generated_project_dir), options)
157+
158+
159+
def generate_project_from_mlf(
160+
template_project_dir: typing.Union[pathlib.Path, str],
161+
project_dir: typing.Union[pathlib.Path, str],
162+
mlf: typing.Union[pathlib.Path, str],
163+
options: dict,
164+
):
165+
"""Generate a project from a platform template and an existing MLF.
166+
167+
Parameters
168+
----------
169+
template_project_path : pathlib.Path or str
170+
Path to a template project containing a microTVM Project API server.
171+
172+
project_dir : pathlib.Path or str
173+
Path to a directory where the project will be created.
174+
175+
mlf : pathlib.Path or str
176+
Path to the Model Library Format archive that will be used when creating
177+
the new project.
178+
179+
options : dict
180+
Project API options given to the microTVM API server for the specified platform.
181+
182+
Returns
183+
-------
184+
GeneratedProject :
185+
A class that wraps the generated project and which can be used to further interact with it.
186+
"""
187+
188+
template = TemplateProject.from_directory(str(template_project_dir))
189+
return template.generate_project_from_mlf(str(mlf), str(project_dir), options)

0 commit comments

Comments
 (0)