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

Function QuantizedWithBroadcast

tensorflow/lite/kernels/div_test.cc:262–280  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

260
261template <TensorType tensor_type, typename integer_dtype>
262void QuantizedWithBroadcast() {
263 const float kQuantizedTolerance = GetTolerance(-3.0, 3.0);
264 const std::vector<std::vector<int>> test_shapes = {
265 {6}, {2, 3}, {2, 1, 3}, {1, 3, 1, 2}};
266 for (int i = 0; i < test_shapes.size(); ++i) {
267 QuantizedDivOpModel m(
268 {tensor_type, test_shapes[i], -3.0, 3.0}, {tensor_type, {}, -3.0, 3.0},
269 {tensor_type, {}, -3.0, 3.0}, ActivationFunctionType_NONE);
270 m.QuantizeAndPopulate<integer_dtype>(m.input1(),
271 {-2.0, 0.2, 0.7, 0.8, -0.5, 1.1});
272 m.QuantizeAndPopulate<integer_dtype>(m.input2(), {0.7});
273 m.Invoke();
274 EXPECT_THAT(
275 m.GetDequantizedOutput<integer_dtype>(),
276 ElementsAreArray(ArrayFloatNear(
277 {-2.857, 0.286, 1.0, 1.143, -0.714, 1.571}, kQuantizedTolerance)))
278 << "With shape number " << i;
279 }
280}
281
282TEST(QuantizedDivOpTest, QuantizedWithBroadcastUInt8) {
283 QuantizedWithBroadcast<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