| 31 | namespace { |
| 32 | |
| 33 | TEST(MaxUnpoolingTest, Kernel2x2Stride2x2) { |
| 34 | TensorRef<BHWC> input; |
| 35 | input.type = DataType::FLOAT32; |
| 36 | input.ref = 0; |
| 37 | input.shape = BHWC(1, 2, 2, 1); |
| 38 | |
| 39 | TensorRef<BHWC> indices; |
| 40 | indices.type = DataType::INT32; |
| 41 | indices.ref = 1; |
| 42 | indices.shape = BHWC(1, 2, 2, 1); |
| 43 | |
| 44 | TensorRef<BHWC> output; |
| 45 | output.type = DataType::FLOAT32; |
| 46 | output.ref = 2; |
| 47 | output.shape = BHWC(1, 4, 4, 1); |
| 48 | |
| 49 | MaxUnpooling2DAttributes attr; |
| 50 | attr.kernel = HW(2, 2); |
| 51 | attr.padding.prepended = HW(0, 0); |
| 52 | attr.padding.appended = HW(0, 0); |
| 53 | attr.strides = HW(2, 2); |
| 54 | |
| 55 | SingleOpModel model({ToString(OperationType::MAX_UNPOOLING_2D), attr}, |
| 56 | {input, indices}, {output}); |
| 57 | ASSERT_TRUE(model.PopulateTensor(0, {1, 2, 3, 4})); |
| 58 | ASSERT_TRUE(model.PopulateTensor(1, {0, 0, 0, 0})); |
| 59 | ASSERT_OK(model.Invoke(*NewMaxUnpoolingNodeShader())); |
| 60 | EXPECT_THAT(model.GetOutput(0), |
| 61 | Pointwise(FloatNear(1e-6), |
| 62 | {1, 0, 2, 0, 0, 0, 0, 0, 3, 0, 4, 0, 0, 0, 0, 0})); |
| 63 | } |
| 64 | |
| 65 | } // namespace |
| 66 | } // namespace gl |
nothing calls this directly
no test coverage detected