Skip to content

Commit

Permalink
[TVMC] Fix to check whether a path passed to --target is strictly a f…
Browse files Browse the repository at this point in the history
…ile (apache#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
  • Loading branch information
leandron authored and trevor-m committed May 11, 2021
1 parent 3d27729 commit ab3e88a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion python/tvm/driver/tvmc/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit ab3e88a

Please sign in to comment.