Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[microTVM] Add wrapper for creating project using a MLF #9090

Merged
merged 1 commit into from
Sep 30, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions python/tvm/micro/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,36 @@ def generate_project(
"""
template = TemplateProject.from_directory(str(template_project_dir))
return template.generate_project(module, str(generated_project_dir), options)


def generate_project_from_mlf(
template_project_dir: Union[pathlib.Path, str],
project_dir: Union[pathlib.Path, str],
mlf_path: Union[pathlib.Path, str],
options: dict,
):
"""Generate a project from a platform template and an existing Model Library Format archive.

Parameters
----------
template_project_path : pathlib.Path or str
Path to a template project containing a microTVM Project API server.

project_dir : pathlib.Path or str
Path to a directory where the project will be created.

mlf_path : pathlib.Path or str
Path to the Model Library Format archive that will be used when creating
the new project.

options : dict
Project API options given to the microTVM API server for the specified platform.

Returns
-------
GeneratedProject :
A class that wraps the generated project and which can be used to further interact with it.
"""

template = TemplateProject.from_directory(str(template_project_dir))
return template.generate_project_from_mlf(str(mlf_path), str(project_dir), options)