From e5c322642aae86fe2d6b823ff50b88f4a4ad9baf Mon Sep 17 00:00:00 2001 From: Leandro Nunes Date: Wed, 28 Oct 2020 16:42:51 +0000 Subject: [PATCH] [TVMC] use common function to obtain target from --target value on 'tvmc compile' - This is solving a TODO item on tvmc --- python/tvm/driver/tvmc/common.py | 1 - python/tvm/driver/tvmc/compiler.py | 11 +---------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/python/tvm/driver/tvmc/common.py b/python/tvm/driver/tvmc/common.py index a625a99f0e7e..9db22f3f3390 100644 --- a/python/tvm/driver/tvmc/common.py +++ b/python/tvm/driver/tvmc/common.py @@ -76,7 +76,6 @@ def convert_graph_layout(mod, desired_layout): ) -# TODO In a separate PR, eliminate the duplicated code here and in compiler.py (@leandron) def target_from_cli(target): """ Create a tvm.target.Target instance from a diff --git a/python/tvm/driver/tvmc/compiler.py b/python/tvm/driver/tvmc/compiler.py index 8001ee29f757..dc337293c9eb 100644 --- a/python/tvm/driver/tvmc/compiler.py +++ b/python/tvm/driver/tvmc/compiler.py @@ -177,16 +177,7 @@ def compile_model( if alter_layout: mod = common.convert_graph_layout(mod, alter_layout) - # Handle the case in which target is a path to a JSON file. - if os.path.exists(target): - with open(target) as target_file: - logger.info("using target input from file: %s", target) - target = "".join(target_file.readlines()) - - # TODO(@leandron) We don't have an API to collect a list of supported - # targets yet - logger.debug("creating target from input: %s", target) - tvm_target = tvm.target.Target(target) + tvm_target = common.target_from_cli(target) target_host = target_host or "" if tuning_records and os.path.exists(tuning_records):