From ab3e88acb908c091e4027b897892b471dfd14f79 Mon Sep 17 00:00:00 2001 From: Leandro Nunes Date: Mon, 15 Mar 2021 17:09:05 +0000 Subject: [PATCH] [TVMC] Fix to check whether a path passed to --target is strictly a file (#7663) * When we use file with --target, the validation in place was only checking whether it was a valid path. For the case in which the path is a directory, it causes a crash when tvmc then tries to open the path. * This fix moved the check to be strictly for files, not only a valid path --- python/tvm/driver/tvmc/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/tvm/driver/tvmc/common.py b/python/tvm/driver/tvmc/common.py index fbd7bc897683..864c3a9bddb4 100644 --- a/python/tvm/driver/tvmc/common.py +++ b/python/tvm/driver/tvmc/common.py @@ -280,7 +280,7 @@ def target_from_cli(target): """ extra_targets = [] - if os.path.exists(target): + if os.path.isfile(target): with open(target) as target_file: logger.debug("target input is a path: %s", target) target = "".join(target_file.readlines())