| 233 | |
| 234 | template <TensorType tensor_type, typename integer_dtype> |
| 235 | void 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 | |
| 257 | TEST(QuantizedDivOpTest, QuantizedVariousInputShapesUInt8) { |
| 258 | QuantizedVariousInputShapes<TensorType_UINT8, uint8_t>(); |
nothing calls this directly
no test coverage detected