diff --git a/onnxruntime/test/perftest/tf_test_session.h b/onnxruntime/test/perftest/tf_test_session.h index 27170db1d7..63aed66094 100644 --- a/onnxruntime/test/perftest/tf_test_session.h +++ b/onnxruntime/test/perftest/tf_test_session.h @@ -116,12 +116,16 @@ class TensorflowTestSession : public TestSession { ORT_THROW_ON_ERROR(OrtGetTensorTypeAndShape(value, &shape)); size_t buffer_length = 0; std::vector dims; - size_t dim_count = OrtGetDimensionsCount(shape); + size_t dim_count; + ORT_THROW_ON_ERROR(OrtGetDimensionsCount(shape, &dim_count)); dims.resize(dim_count); - OrtGetDimensions(shape, dims.data(), dim_count); - int64_t ele_count = OrtGetTensorShapeElementCount(shape); + ORT_THROW_ON_ERROR(OrtGetDimensions(shape, dims.data(), dim_count)); + size_t ele_count; + ORT_THROW_ON_ERROR(OrtGetTensorShapeElementCount(shape, &ele_count)); TF_DataType tf_datatype; - switch (OrtGetTensorElementType(shape)) { + ONNXTensorElementDataType element_type; + ORT_THROW_ON_ERROR(OrtGetTensorElementType(shape, &element_type)); + switch (element_type) { case ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT: // maps to c type float buffer_length = ele_count * sizeof(float); tf_datatype = TF_FLOAT;