From 15bcde5053d5ab482c49bad6de2eb832ab83fe54 Mon Sep 17 00:00:00 2001 From: Changming Sun Date: Tue, 11 Jun 2019 14:05:24 -0700 Subject: [PATCH] Fix a build break in tf_test_session.h (#1205) This file need tensorflow C API package to build, so it is not part of the CI. --- onnxruntime/test/perftest/tf_test_session.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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;