| 32 | namespace { |
| 33 | |
| 34 | TEST_F(OpenCLOperationTest, Reshape) { |
| 35 | TensorFloat32 src_tensor; |
| 36 | src_tensor.shape = BHWC(1, 2, 1, 3); |
| 37 | src_tensor.data = {half(0.5f), half(-1.1f), half(-2.2f), |
| 38 | half(3.1f), half(1.2f), half(2.9f)}; |
| 39 | |
| 40 | for (auto storage : env_.GetSupportedStorages()) { |
| 41 | for (auto precision : env_.GetSupportedPrecisions()) { |
| 42 | OperationDef op_def; |
| 43 | op_def.precision = precision; |
| 44 | auto data_type = DeduceDataTypeFromPrecision(precision); |
| 45 | op_def.src_tensors.push_back({data_type, storage}); |
| 46 | op_def.dst_tensors.push_back({data_type, storage}); |
| 47 | TensorFloat32 dst_tensor; |
| 48 | Reshape operation = CreateReshape(op_def); |
| 49 | ASSERT_OK(ExecuteGPUOperation(src_tensor, creation_context_, &operation, |
| 50 | BHWC(1, 3, 1, 2), &dst_tensor)); |
| 51 | EXPECT_THAT( |
| 52 | dst_tensor.data, |
| 53 | Pointwise(FloatNear(0.0f), {half(0.5f), half(-1.1f), half(-2.2f), |
| 54 | half(3.1f), half(1.2f), half(2.9f)})); |
| 55 | } |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | } // namespace |
| 60 | } // namespace cl |
nothing calls this directly
no test coverage detected