17 CHECK(vec1.size() == vec2.size());
19 bool mismatch =
false;
20 for (uint32_t i = 0; i < vec1.size(); ++i)
22 if (vec1[i] != vec2[i])
24 MESSAGE(fmt::format(
"Vector value mismatch: index={} {} != {}",
35 FAIL(
"Error in CompareVector. Vectors don't match.");
40 TEST_CASE(
"RefPerChannelDecoderTest1")
42 using namespace armnn;
43 std::vector<int8_t> input =
45 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23
48 std::vector<float> expOutput =
50 0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f,
51 24.0f, 26.0f, 28.0f, 30.0f, 32.0f, 34.0f, 36.0f, 38.0f, 40.0f, 42.0f, 44.0f, 46.0f
55 auto decoder = MakeDecoder<float>(tensorInfo, input.data());
57 std::vector<float> output = decoder->DecodeTensor(tensorInfo.GetShape());
63 TEST_CASE(
"RefPerChannelDecoderTest2")
65 using namespace armnn;
66 std::vector<int8_t> input =
68 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
71 std::vector<float> expOutput =
73 0.0f, 1.0f, 2.0f, 3.0f,
74 8.0f, 10.0f, 12.0f, 14.0f,
75 24.0f, 27.0f, 30.0f, 33.0f,
76 48.0f, 52.0f, 56.0f, 60.0f
81 auto decoder = MakeDecoder<float>(tensorInfo, input.data());
83 std::vector<float> output = decoder->DecodeTensor(tensorInfo.GetShape(),
true);
89 TEST_CASE(
"RefPerChannelDecoderTest3")
91 using namespace armnn;
92 std::vector<int8_t> input =
102 std::vector<float> expOutput =
104 0.0f, 1.0f, 2.0f, 3.0f,
105 8.0f, 10.0f, 12.0f, 14.0f,
106 24.0f, 27.0f, 30.0f, 33.0f,
107 48.0f, 52.0f, 56.0f, 60.0f,
108 80.0f, 85.0f, 90.0f, 95.0f,
109 120.0f, 126.0f, 132.0f, 138.0f
113 TensorInfo tensorInfo ({6,1,2,2},
DataType::QSymmS8,{1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f},0);
114 auto decoder = MakeDecoder<float>(tensorInfo, input.data());
116 std::vector<float> output = decoder->DecodeTensor(tensorInfo.GetShape(),
true);
122 TEST_CASE(
"RefPerChannelDecoderTest4")
124 using namespace armnn;
125 std::vector<int32_t> input =
135 std::vector<float> expOutput =
137 0.0f, 1.0f, 2.0f, 3.0f,
138 8.0f, 10.0f, 12.0f, 14.0f,
139 24.0f, 27.0f, 30.0f, 33.0f,
140 48.0f, 52.0f, 56.0f, 60.0f,
141 80.0f, 85.0f, 90.0f, 95.0f,
142 120.0f, 126.0f, 132.0f, 138.0f
146 TensorInfo tensorInfo ({6,1,2,2},
DataType::Signed32,{1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f},0);
147 auto decoder = MakeDecoder<float>(tensorInfo, input.data());
149 std::vector<float> output = decoder->DecodeTensor(tensorInfo.GetShape(),
true);
void CompareVector(std::vector< T > vec1, std::vector< T > vec2)
Copyright (c) 2021 ARM Limited and Contributors.