| 37 | } |
| 38 | |
| 39 | TEST(ElementwiseTest, Abs) { |
| 40 | OperationType op_type = OperationType::ABS; |
| 41 | const BHWC shape(1, 2, 2, 1); |
| 42 | SingleOpModel model({/*type=*/ToString(op_type), /*attributes=*/{}}, |
| 43 | /*inputs=*/{GetTensorRef(0, shape)}, |
| 44 | /*outputs=*/{GetTensorRef(1, shape)}); |
| 45 | ASSERT_TRUE(model.PopulateTensor(0, {0.0, -6.2, 2.0, 4.0})); |
| 46 | ASSERT_OK(model.Invoke(*NewElementwiseNodeShader(op_type))); |
| 47 | EXPECT_THAT(model.GetOutput(0), |
| 48 | Pointwise(FloatNear(1e-6), {0.0, 6.2, 2.0, 4.0})); |
| 49 | } |
| 50 | |
| 51 | TEST(ElementwiseTest, Cos) { |
| 52 | OperationType op_type = OperationType::COS; |
nothing calls this directly
no test coverage detected