MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / QuantizedVariousInputShapes

Function QuantizedVariousInputShapes

tensorflow/lite/kernels/div_test.cc:235–255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

233
234template <TensorType tensor_type, typename integer_dtype>
235void QuantizedVariousInputShapes() {
236 const float kQuantizedTolerance = GetTolerance(-3.0, 3.0);
237 const std::vector<std::vector<int>> test_shapes = {
238 {6}, {2, 3}, {2, 1, 3}, {1, 3, 1, 2}};
239 for (int i = 0; i < test_shapes.size(); ++i) {
240 QuantizedDivOpModel m({tensor_type, test_shapes[i], -3.0, 3.0},
241 {tensor_type, test_shapes[i], -3.0, 3.0},
242 {tensor_type, {}, -3.0, 3.0},
243 ActivationFunctionType_NONE);
244 m.QuantizeAndPopulate<integer_dtype>(m.input1(),
245 {-2.0, 0.2, 1.7, 0.9, 0.4, 2.0});
246 m.QuantizeAndPopulate<integer_dtype>(m.input2(),
247 {1.3, 0.3, 1.1, 0.4, -1.1, 1.9});
248 m.Invoke();
249 EXPECT_THAT(
250 m.GetDequantizedOutput<integer_dtype>(),
251 ElementsAreArray(ArrayFloatNear(
252 {-1.538, 0.667, 1.545, 2.25, -0.364, 1.053}, kQuantizedTolerance)))
253 << "With shape number " << i;
254 }
255}
256
257TEST(QuantizedDivOpTest, QuantizedVariousInputShapesUInt8) {
258 QuantizedVariousInputShapes<TensorType_UINT8, uint8_t>();

Callers

nothing calls this directly

Calls 6

GetToleranceFunction · 0.70
ArrayFloatNearFunction · 0.70
sizeMethod · 0.45
input1Method · 0.45
input2Method · 0.45
InvokeMethod · 0.45

Tested by

no test coverage detected