From d08eb9a813d8fe46767ed031cf1c109d855d378a Mon Sep 17 00:00:00 2001 From: Tianqi Chen Date: Mon, 7 Sep 2020 17:02:55 -0700 Subject: [PATCH] [TESTING] Fix the error when running tests with default targets (#6394) --- python/tvm/testing.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/python/tvm/testing.py b/python/tvm/testing.py index 0a568b0..270f37f 100644 --- a/python/tvm/testing.py +++ b/python/tvm/testing.py @@ -329,11 +329,13 @@ def _get_targets(): target_str = os.environ.get("TVM_TEST_TARGETS", "") if len(target_str) == 0: target_str = DEFAULT_TEST_TARGETS - targets = { - dev - for dev in target_str.split(";") - if len(dev) > 0 and tvm.context(dev, 0).exist and tvm.runtime.enabled(dev) - } + targets = set() + for dev in target_str.split(";"): + if len(dev) == 0: + continue + target_kind = dev.split()[0] + if tvm.runtime.enabled(target_kind) and tvm.context(target_kind, 0).exist: + targets.add(dev) if len(targets) == 0: logging.warning( "None of the following targets are supported by this build of TVM: %s." -- 2.7.4