Lunderberg commented on a change in pull request #8161:
URL: https://github.com/apache/tvm/pull/8161#discussion_r641832386
##########
File path: python/tvm/relay/backend/vm.py
##########
@@ -198,20 +198,29 @@ def _update_target(self, target):
target = target if target else tvm.target.Target.current()
if target is None:
raise ValueError("Target is not set in env or passed as argument.")
- tgts = {}
- if isinstance(target, (str, tvm.target.Target)):
- dev_type = tvm.tir.IntImm("int32",
tvm.nd.device(str(target)).device_type)
- tgts[dev_type] = tvm.target.Target(target)
- elif isinstance(target, dict):
- for dev, tgt in target.items():
- dev_type = tvm.tir.IntImm("int32",
tvm.nd.device(dev).device_type)
- tgts[dev_type] = tvm.target.Target(tgt)
- else:
+
+ elif isinstance(target, str):
+ target = {target: target}
+
+ elif isinstance(target, tvm.target.Target):
+ target = {target.kind.name: target}
+
+ elif not isinstance(target, dict):
raise TypeError(
"target is expected to be str, tvm.target.Target, "
+ "or dict of str to str/tvm.target.Target, but received "
+ "{}".format(type(target))
)
+
+ tgts = {}
+
Review comment:
I think this line necessary, because this is the return value into
which the results are collected.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]