@@ -2238,12 +2238,16 @@ ModelInstanceState::SetInputTensors(
2238
2238
TRITONBACKEND_RequestInput (requests[idx], input_name, &input));
2239
2239
const int64_t * input_shape;
2240
2240
uint32_t input_dims_count;
2241
+ int64_t element_cnt = 0 ;
2241
2242
RESPOND_AND_SET_NULL_IF_ERROR (
2242
2243
&((*responses)[idx]), TRITONBACKEND_InputProperties (
2243
2244
input, nullptr , nullptr , &input_shape,
2244
2245
&input_dims_count, nullptr , nullptr ));
2246
+ RESPOND_AND_SET_NULL_IF_ERROR (
2247
+ &((*responses)[idx]),
2248
+ GetElementCount (input_shape, input_dims_count, &element_cnt));
2245
2249
2246
- batchn_shape[0 ] += GetElementCount (input_shape, input_dims_count) ;
2250
+ batchn_shape[0 ] += element_cnt ;
2247
2251
}
2248
2252
}
2249
2253
// The shape for the entire input batch, [total_batch_size, ...]
@@ -2402,8 +2406,10 @@ ModelInstanceState::SetStringInputTensor(
2402
2406
expected_byte_sizes.push_back (0 );
2403
2407
expected_element_cnts.push_back (0 );
2404
2408
} else {
2405
- expected_element_cnts.push_back (
2406
- GetElementCount (input_shape, input_dims_count));
2409
+ int64_t element_cnt = 0 ;
2410
+ RETURN_IF_ERROR (
2411
+ GetElementCount (input_shape, input_dims_count, &element_cnt));
2412
+ expected_element_cnts.push_back (element_cnt);
2407
2413
expected_byte_sizes.push_back (input_byte_size);
2408
2414
}
2409
2415
@@ -2573,8 +2579,9 @@ ModelInstanceState::ReadOutputTensor(
2573
2579
ONNXTensorElementDataType type;
2574
2580
RETURN_IF_ORT_ERROR (ort_api->GetTensorElementType (type_and_shape, &type));
2575
2581
if (type == ONNX_TENSOR_ELEMENT_DATA_TYPE_STRING) {
2576
- const size_t element_count = GetElementCount (batchn_shape) ;
2582
+ int64_t element_count = 0 ;
2577
2583
size_t total_length = 0 ;
2584
+ RETURN_IF_ERROR (GetElementCount (batchn_shape, &element_count));
2578
2585
RETURN_IF_ORT_ERROR (
2579
2586
ort_api->GetStringTensorDataLength (output_tensor, &total_length));
2580
2587
@@ -2776,7 +2783,9 @@ ModelInstanceState::SetStringBuffer(
2776
2783
(*batchn_shape)[0 ] = shape[0 ];
2777
2784
}
2778
2785
2779
- const size_t expected_element_cnt = GetElementCount (*batchn_shape);
2786
+ int64_t expected_element_cnt = 0 ;
2787
+ RESPOND_AND_SET_NULL_IF_ERROR (
2788
+ &response, GetElementCount (*batchn_shape, &expected_element_cnt));
2780
2789
2781
2790
// If 'request' requested this output then copy it from
2782
2791
// 'content'. If it did not request this output then just skip it
0 commit comments