Skip to content

Commit

Permalink
[Relay] Modify create_executor to pass params (#8418)
Browse files Browse the repository at this point in the history
* Overload create_executor to accept params

* [fix] Add stringdoc for new param in create_executor
  • Loading branch information
mikepapadim authored Jul 13, 2021
1 parent 80f48c7 commit 957cc12
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion python/tvm/relay/build_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ def _graph_wrapper(*args, **kwargs):
return _graph_wrapper


def create_executor(kind="debug", mod=None, device=None, target="llvm"):
def create_executor(kind="debug", mod=None, device=None, target="llvm", params=None):
"""Factory function to create an executor.
Example
Expand Down Expand Up @@ -544,6 +544,10 @@ def create_executor(kind="debug", mod=None, device=None, target="llvm"):
target : :py:class:`tvm.Target`
The corresponding context
params : dict of str to NDArray
Input parameters to the graph that do not change
during inference time.
Returns
-------
executor : :py:class:`~tvm.relay.backend.interpreter.Executor`
Expand All @@ -555,6 +559,9 @@ def create_executor(kind="debug", mod=None, device=None, target="llvm"):
else:
device = _nd.device(str(target), 0)

if params is not None:
mod = IRModule.from_expr(bind_params_by_name(mod["main"], params))

if isinstance(target, str):
target = Target(target)
if kind == "debug":
Expand Down

0 comments on commit 957cc12

Please sign in to comment.