From a59be20202f0dbd27b9a2752ce52496dc0ed46a1 Mon Sep 17 00:00:00 2001 From: Leandro Nunes Date: Mon, 15 Mar 2021 09:53:55 +0000 Subject: [PATCH] [TVMC] Fix to check whether a path passed to --target is strictly a file * 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 c5cb5f29031f..ad9ff1c11b63 100644 --- a/python/tvm/driver/tvmc/common.py +++ b/python/tvm/driver/tvmc/common.py @@ -270,7 +270,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())