|
37 | 37 | import tempfile |
38 | 38 | import multiprocessing |
39 | 39 | import logging |
40 | | -import copy |
41 | 40 |
|
42 | 41 | import tvm._ffi |
43 | 42 | from tvm.runtime import Object, module, ndarray |
@@ -910,18 +909,18 @@ def _timed_eval_func( |
910 | 909 | random_fill = tvm.get_global_func("tvm.contrib.random.random_fill", True) |
911 | 910 | assert random_fill, "Please make sure USE_RANDOM is ON in the config.cmake" |
912 | 911 | assert len(args) == len(build_res.args) |
913 | | - loc_args = copy.deepcopy(args) |
| 912 | + loc_args = [] |
914 | 913 | # pylint: disable=consider-using-enumerate |
915 | | - for idx in range(len(loc_args)): |
916 | | - if loc_args[idx] is None: |
| 914 | + for idx in range(len(args)): |
| 915 | + if args[idx] is None: |
917 | 916 | build_res_arg = build_res.args[idx] |
918 | 917 | empty_array = ndarray.empty( |
919 | 918 | get_const_tuple(build_res_arg.shape), build_res_arg.dtype, dev |
920 | 919 | ) |
921 | 920 | random_fill(empty_array) |
922 | | - loc_args[idx] = empty_array |
| 921 | + loc_args.append(empty_array) |
923 | 922 | else: |
924 | | - loc_args[idx] = ndarray.array(loc_args[idx], dev) |
| 923 | + loc_args.append(ndarray.array(arg)) |
925 | 924 | dev.sync() |
926 | 925 | costs = time_f(*loc_args).results |
927 | 926 | # pylint: disable=broad-except |
@@ -1114,18 +1113,18 @@ def _rpc_run( |
1114 | 1113 | ), "Please make sure USE_RANDOM is ON in the config.cmake on the remote devices" |
1115 | 1114 |
|
1116 | 1115 | assert len(args) == len(build_res.args) |
1117 | | - loc_args = copy.deepcopy(args) |
| 1116 | + loc_args = [] |
1118 | 1117 | # pylint: disable=consider-using-enumerate |
1119 | | - for idx in range(len(loc_args)): |
1120 | | - if loc_args[idx] is None: |
| 1118 | + for idx in range(len(args)): |
| 1119 | + if args[idx] is None: |
1121 | 1120 | build_res_arg = build_res.args[idx] |
1122 | 1121 | empty_array = ndarray.empty( |
1123 | 1122 | get_const_tuple(build_res_arg.shape), build_res_arg.dtype, dev |
1124 | 1123 | ) |
1125 | 1124 | random_fill(empty_array) |
1126 | | - loc_args[idx] = empty_array |
| 1125 | + loc_args.append(empty_array) |
1127 | 1126 | else: |
1128 | | - loc_args[idx] = ndarray.array(loc_args[idx], dev) |
| 1127 | + loc_args.append(ndarray.array(args[idx], dev)) |
1129 | 1128 | dev.sync() |
1130 | 1129 |
|
1131 | 1130 | # First run for check that the kernel is correct |
|
0 commit comments