| 260 | |
| 261 | template <TensorType tensor_type, typename integer_dtype> |
| 262 | void 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 | |
| 282 | TEST(QuantizedDivOpTest, QuantizedWithBroadcastUInt8) { |
| 283 | QuantizedWithBroadcast<TensorType_UINT8, uint8_t>(); |
nothing calls this directly
no test coverage detected