Commit 390acc52 by Lianmin Zheng Committed by Tianqi Chen

[AUTOTVM] Fix measurement for CPU (#1956)

parent e61659a9
...@@ -460,7 +460,11 @@ def run_through_rpc(measure_input, build_result, ...@@ -460,7 +460,11 @@ def run_through_rpc(measure_input, build_result,
if ref_input: if ref_input:
args = [nd.array(x, ctx=ctx) for x in ref_input] args = [nd.array(x, ctx=ctx) for x in ref_input]
else: else:
# create empty arrays on the remote device and copy them once.
# This can avoid some memory issues that make the measurment results unreliable.
args = [nd.empty(x[0], dtype=x[1], ctx=ctx) for x in build_result.arg_info] args = [nd.empty(x[0], dtype=x[1], ctx=ctx) for x in build_result.arg_info]
args = [nd.array(x, ctx=ctx) for x in args]
ctx.sync()
costs = time_f(*args).results costs = time_f(*args).results
if len(costs) > 2: # remove largest and smallest value to reduce variance if len(costs) > 2: # remove largest and smallest value to reduce variance
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment