@@ -2105,7 +2105,11 @@ ModelInstanceState::SetInputTensors(
2105
2105
input, nullptr , nullptr , &input_shape,
2106
2106
&input_dims_count, nullptr , nullptr ));
2107
2107
2108
- batchn_shape[0 ] += GetElementCount (input_shape, input_dims_count);
2108
+ int64_t element_cnt = 0 ;
2109
+ RESPOND_AND_SET_NULL_IF_ERROR (
2110
+ &((*responses)[idx]),
2111
+ GetElementCount (input_shape, input_dims_count, &element_cnt));
2112
+ batchn_shape[0 ] += element_cnt;
2109
2113
}
2110
2114
} else {
2111
2115
batchn_shape =
@@ -2160,7 +2164,10 @@ ModelInstanceState::SetInputTensors(
2160
2164
input, HostPolicyName ().c_str (), nullptr , nullptr , &shape,
2161
2165
&dims_count, nullptr , &buffer_count));
2162
2166
2163
- const int64_t batch_element_cnt = GetElementCount (shape, dims_count);
2167
+ int64_t batch_element_cnt = 0 ;
2168
+ RESPOND_AND_SET_NULL_IF_ERROR (
2169
+ &((*responses)[idx]),
2170
+ GetElementCount (shape, dims_count, &batch_element_cnt));
2164
2171
2165
2172
*cuda_copy |= SetStringInputTensor (
2166
2173
&input_list, input, input_name, buffer_count, batch_element_cnt,
@@ -2347,7 +2354,8 @@ ModelInstanceState::ReadOutputTensors(
2347
2354
batchn_shape[0 ] = shape[0 ];
2348
2355
}
2349
2356
2350
- const size_t tensor_element_cnt = GetElementCount (batchn_shape);
2357
+ int64_t tensor_element_cnt = 0 ;
2358
+ RETURN_IF_ERROR (GetElementCount (batchn_shape, &tensor_element_cnt));
2351
2359
2352
2360
// Only need an response tensor for requested outputs.
2353
2361
if (response != nullptr ) {
0 commit comments