From ddee5049b07afb8d789317dd9d7cc6c50f229c5a Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Thu, 22 Apr 2021 11:12:40 +0800 Subject: [PATCH] Fix ut. --- .../testcase/ge_graph/ge_def_type_unittest.cc | 32 ------------------- .../testcase/ge_graph/ge_tensor_unittest.cc | 12 ------- 2 files changed, 44 deletions(-) diff --git a/tests/ut/common/graph/testcase/ge_graph/ge_def_type_unittest.cc b/tests/ut/common/graph/testcase/ge_graph/ge_def_type_unittest.cc index 10d6dc86..7dc124fe 100644 --- a/tests/ut/common/graph/testcase/ge_graph/ge_def_type_unittest.cc +++ b/tests/ut/common/graph/testcase/ge_graph/ge_def_type_unittest.cc @@ -32,14 +32,6 @@ class UtestGeTestDefType : public testing::Test { void TearDown() {} }; -TEST_F(UtestGeTestDefType, base) { - CompressInfo com1; - com1.set_blockrow(1); - int32_t a = com1.blockrow; - EXPECT_EQ(a, 1); - -} - TEST_F(UtestGeTestDefType, quant) { OpDescPtr desc_ptr1 = std::make_shared("name1", "type1"); EXPECT_EQ(desc_ptr1->AddInputDesc("x", GeTensorDesc(GeShape({1, 16, 16, 16}), FORMAT_NCHW)), GRAPH_SUCCESS); @@ -48,28 +40,4 @@ TEST_F(UtestGeTestDefType, quant) { EXPECT_EQ(OpDescUtils::HasQuantizeFactorParams(desc_ptr1), false); EXPECT_EQ(OpDescUtils::HasQuantizeFactorParams(*desc_ptr1), false); - QuantizeFactorParams q1; - EXPECT_EQ(q1.has_quantize_param(), false); - QuantizeFactor *qf1 = q1.mutable_quantize_param(); - EXPECT_EQ(q1.has_quantize_param(), true); - - string s1 = "value1"; - q1.quantize_param.set_scale_value(s1.data(), s1.size()); - EXPECT_EQ(OpDescUtils::SetQuantizeFactorParams(desc_ptr1, q1), GRAPH_SUCCESS); - QuantizeFactorParams q2; - EXPECT_EQ(OpDescUtils::GetQuantizeFactorParams(desc_ptr1, q2), GRAPH_SUCCESS); - string s2((char *)q2.quantize_param.scale_value.GetData(), q2.quantize_param.scale_value.GetSize()); - EXPECT_EQ(s2, "value1"); - - float f[2] = {1, 2}; - string s(static_cast(static_cast(f)), 2 * sizeof(float)); - q1.quantize_param.set_scale_value(f, 2 * sizeof(float)); - EXPECT_EQ(OpDescUtils::SetQuantizeFactorParams(*desc_ptr1, q1), GRAPH_SUCCESS); - QuantizeFactorParams q3; - EXPECT_EQ(OpDescUtils::GetQuantizeFactorParams(*desc_ptr1, q3), GRAPH_SUCCESS); - Buffer &b = q3.quantize_param.scale_value; - float f1[2]; - memcpy(f1, b.GetData(), b.GetSize()); - EXPECT_EQ(f1[0], 1); - EXPECT_EQ(f1[1], 2); } diff --git a/tests/ut/common/graph/testcase/ge_graph/ge_tensor_unittest.cc b/tests/ut/common/graph/testcase/ge_graph/ge_tensor_unittest.cc index 5c75bd01..aa43ac99 100644 --- a/tests/ut/common/graph/testcase/ge_graph/ge_tensor_unittest.cc +++ b/tests/ut/common/graph/testcase/ge_graph/ge_tensor_unittest.cc @@ -209,18 +209,6 @@ TEST_F(UtestGeTensor, test_tensor_desc_invalid_null) { tensor_desc2.SetDataType(DT_DUAL_SUB_INT8); EXPECT_EQ(tensor_desc2.GetDataType(), DT_DUAL_SUB_INT8); - CompressInfo info; - EXPECT_EQ(TensorUtils::GetCmpsInfo(tensor_desc2, info), GRAPH_FAILED); - TensorUtils::SetCmpsInfo(tensor_desc2, info); - EXPECT_EQ(TensorUtils::GetCmpsInfo(tensor_desc2, info), GRAPH_SUCCESS); - - AllOffsetQuantizeInfo quantize_info; - EXPECT_FALSE(TensorUtils::HasAlloffsetQuantizeInfo(tensor_desc2)); - EXPECT_EQ(TensorUtils::GetAlloffsetQuantizeInfo(tensor_desc2, quantize_info), GRAPH_FAILED); - TensorUtils::SetAlloffsetQuantizeInfo(tensor_desc2, quantize_info); - EXPECT_EQ(TensorUtils::GetAlloffsetQuantizeInfo(tensor_desc2, quantize_info), GRAPH_SUCCESS); - EXPECT_TRUE(TensorUtils::HasAlloffsetQuantizeInfo(tensor_desc2)); - TensorUtils::SetWeightSize(tensor_desc, 100); EXPECT_EQ(TensorUtils::GetWeightSize(tensor_desc), 0); }