| 316 | } |
| 317 | |
| 318 | void SimpleTest(TfLiteRegistration* registration, int num_thread) { |
| 319 | DepthwiseConvolutionOpModel m(registration, |
| 320 | {TensorType_FLOAT32, {1, 3, 2, 2}}, |
| 321 | {TensorType_FLOAT32, {1, 2, 2, 4}}, |
| 322 | {TensorType_FLOAT32, {}}, Padding_VALID); |
| 323 | |
| 324 | m.SetInput({ |
| 325 | 1, 2, 7, 8, // column 1 |
| 326 | 3, 4, 9, 10, // column 2 |
| 327 | 5, 6, 11, 12, // column 3 |
| 328 | }); |
| 329 | m.SetFilter({ |
| 330 | 1, 2, 3, 4, // |
| 331 | -9, 10, -11, 12, // |
| 332 | 5, 6, 7, 8, // |
| 333 | 13, -14, 15, -16, // |
| 334 | }); |
| 335 | m.SetBias({1, 2, 3, 4}); |
| 336 | |
| 337 | m.Invoke(); |
| 338 | |
| 339 | EXPECT_THAT(m.GetOutput(), ElementsAreArray({ |
| 340 | 71, -34, 99, -20, // |
| 341 | 91, -26, 127, -4, // |
| 342 | })); |
| 343 | } |
| 344 | |
| 345 | TEST_P(DepthwiseConvolutionOpTest, SimpleTest) { |
| 346 | SimpleTest(GetRegistration(), /*num_thread=*/1); |