From 3ea6895d54513f9458ea4b480c33bfc1e710064f Mon Sep 17 00:00:00 2001 From: tqchen Date: Thu, 3 Sep 2020 10:11:38 -0700 Subject: [PATCH] [TESTING] Fix the error when running tests with default targets --- 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 0a568b02fc9d..270f37f2e28b 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."