| 32 | namespace { |
| 33 | |
| 34 | TEST(SoftmaxTest, Softmax) { |
| 35 | TensorRef<BHWC> input; |
| 36 | input.type = DataType::FLOAT32; |
| 37 | input.ref = 0; |
| 38 | input.shape = BHWC(1, 2, 2, 1); |
| 39 | |
| 40 | TensorRef<BHWC> output; |
| 41 | output.type = DataType::FLOAT32; |
| 42 | output.ref = 1; |
| 43 | output.shape = BHWC(1, 2, 2, 1); |
| 44 | |
| 45 | SoftmaxAttributes attr; |
| 46 | attr.axis = Axis::CHANNELS; |
| 47 | |
| 48 | SingleOpModel model({ToString(OperationType::SOFTMAX), attr}, {input}, |
| 49 | {output}); |
| 50 | ASSERT_TRUE(model.PopulateTensor(0, {0.1, 0.2, 0.1, 0.2})); |
| 51 | ASSERT_OK(model.Invoke(*NewSoftmaxNodeShader())); |
| 52 | EXPECT_THAT(model.GetOutput(0), Pointwise(FloatNear(1e-6), {1, 1, 1, 1})); |
| 53 | } |
| 54 | |
| 55 | TEST(SoftmaxTest, DoesNotWorkForHeightAxis) { |
| 56 | TensorRef<BHWC> input; |
nothing calls this directly
no test coverage detected