Commit 9d0dcde7 authored by yimeisun123's avatar yimeisun123 Committed by Scott Cyphers

Fix uninitialized parameter tensor data in nbench (#2114)

* Fix uninitialized parameter tensor data in nbench

* Remove const modifier in the loop to fix compilation error

* Add condition check before writing tensor data

* Remove the condition check when initializing pramater tensor data
parent 26669ae8
......@@ -182,6 +182,9 @@ vector<runtime::PerformanceCounter> run_benchmark(shared_ptr<Function> f,
auto tensor_data =
make_shared<runtime::HostTensor>(param->get_element_type(), param->get_shape());
random_init(tensor_data);
tensor->write(tensor_data->get_data_ptr(),
0,
tensor_data->get_element_count() * tensor_data->get_element_type().size());
args.push_back(tensor);
arg_data.push_back(tensor_data);
args_cacheable.push_back(param->get_cacheable());
......
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