Skip to content

Commit 39ff24e

Browse files
authored
Fix swapped count and value arguments to std::vector constructor. (microsoft#25706)
### Description <!-- Describe your changes. --> Fix swapped value and count arguments to `std::vector` constructor. The `std::vector` constructor signature is: `vector( size_type count, const T& value, const Allocator& alloc = Allocator() );` https://en.cppreference.com/w/cpp/container/vector/vector.html ### Motivation and Context <!-- - Why is this change required? What problem does it solve? - If it fixes an open issue, please link to the issue here. --> Fix issue discovered after enabling warning. ``` Error: E:\_work\onnxruntime\onnxruntime\onnxruntime\test\providers\tensorrt\tensorrt_basic_test.cc(688,34): error C2220: the following warning is treated as an error [E:\_work\_temp\build\RelWithDebInfo\onnxruntime_provider_test.vcxproj] Warning: E:\_work\onnxruntime\onnxruntime\onnxruntime\test\providers\tensorrt\tensorrt_basic_test.cc(688,34): warning C4244: 'argument': conversion from 'float' to 'const unsigned __int64', possible loss of data [E:\_work\_temp\build\RelWithDebInfo\onnxruntime_provider_test.vcxproj] ```
1 parent c5a8c53 commit 39ff24e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

onnxruntime/test/providers/tensorrt/tensorrt_basic_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ TEST(TensorrtExecutionProviderTest, TRTPluginsCustomOpTest) {
685685
auto cuda_provider = DefaultCudaExecutionProvider();
686686
auto cpu_allocator = cuda_provider->CreatePreferredAllocators()[1];
687687
std::vector<int64_t> dims_op_x = {12, 256, 256};
688-
std::vector<float> values_op_x(1.0f, 786432); // 786432=12*256*256
688+
std::vector<float> values_op_x(786432, 1.0f); // 786432=12*256*256
689689
OrtValue ml_value_x;
690690
CreateMLValue<float>(cpu_allocator, dims_op_x, values_op_x, &ml_value_x);
691691
OrtValue ml_value_y;

0 commit comments

Comments
 (0)