areusch commented on a change in pull request #8113:
URL: https://github.com/apache/tvm/pull/8113#discussion_r638260969
##########
File path: python/tvm/autotvm/measure/measure_methods.py
##########
@@ -242,6 +243,22 @@ def __init__(
self.executor = LocalExecutor(timeout=timeout * (self.n_parallel + 1))
+ @property
+ def ref_input(self):
+ """Fixed input for tuning special operators."""
+ return self._ref_input if hasattr(self, "_ref_input") else None
Review comment:
seems as though we could just set `self._ref_input` to `None` in
`__init__` if it is not set. also, why this style of setting, rather than
taking as an `__init__` arg?
##########
File path: python/tvm/autotvm/measure/measure_methods.py
##########
@@ -575,18 +596,22 @@ def run_through_rpc(
f_preproc=f_prepare,
)
- try:
- random_fill =
remote.get_function("tvm.contrib.random.random_fill")
- except AttributeError:
- raise AttributeError(
- "Please make sure USE_RANDOM is ON in the config.cmake "
"on the remote devices"
- )
- args = [nd.empty(x[0], x[1], dev) for x in build_result.arg_info]
- if "scatter" not in measure_input.task.name:
- # the index tensor of scatter op cannot be randomly initialized
- for arg in args:
- random_fill(arg)
- dev.sync()
+ if ref_input:
+ args = [nd.array(x, device=dev) for x in ref_input]
+ else:
+ try:
+ random_fill =
remote.get_function("tvm.contrib.random.random_fill")
+ except AttributeError:
+ raise AttributeError(
+ "Please make sure USE_RANDOM is ON in the config.cmake
"
+ "on the remote devices"
+ )
+ args = [nd.empty(x[0], x[1], dev) for x in
build_result.arg_info]
+ if "scatter" not in measure_input.task.name:
+ # the index tensor of scatter op cannot be randomly
initialized
+ for arg in args:
+ random_fill(arg)
+ dev.sync()
Review comment:
does this need to run for both if branches?
--
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]