| 32 | namespace { |
| 33 | |
| 34 | TEST_F(OpenCLOperationTest, ConcatWidth) { |
| 35 | TensorFloat32 src0, src1; |
| 36 | src0.shape = BHWC(1, 2, 1, 2); |
| 37 | src0.data = {half(0.0f), half(-1.0f), half(-0.05f), half(0.045f)}; |
| 38 | src1.shape = BHWC(1, 2, 2, 2); |
| 39 | src1.data = {half(1.0f), half(-1.2f), half(-0.45f), half(1.045f), |
| 40 | half(1.1f), half(-1.3f), half(-0.55f), half(2.045f)}; |
| 41 | |
| 42 | ConcatAttributes attr; |
| 43 | attr.axis = Axis::WIDTH; |
| 44 | |
| 45 | for (auto storage : env_.GetSupportedStorages()) { |
| 46 | for (auto precision : env_.GetSupportedPrecisions()) { |
| 47 | OperationDef op_def; |
| 48 | op_def.precision = precision; |
| 49 | auto data_type = DeduceDataTypeFromPrecision(precision); |
| 50 | op_def.src_tensors.push_back({data_type, storage}); |
| 51 | op_def.src_tensors.push_back({data_type, storage}); |
| 52 | op_def.dst_tensors.push_back({data_type, storage}); |
| 53 | TensorFloat32 dst_tensor; |
| 54 | ConcatXY operation = CreateConcatXY(op_def, attr, 2); |
| 55 | ASSERT_OK(ExecuteGPUOperation({src0, src1}, creation_context_, &operation, |
| 56 | BHWC(1, 2, 3, 2), &dst_tensor)); |
| 57 | EXPECT_THAT( |
| 58 | dst_tensor.data, |
| 59 | Pointwise(FloatNear(0.0f), |
| 60 | {half(0.0f), half(-1.0f), half(1.0f), half(-1.2f), |
| 61 | half(-0.45f), half(1.045f), half(-0.05f), half(0.045f), |
| 62 | half(1.1f), half(-1.3f), half(-0.55f), half(2.045f)})); |
| 63 | } |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | TEST_F(OpenCLOperationTest, ConcatHeight) { |
| 68 | TensorFloat32 src0, src1; |
nothing calls this directly
no test coverage detected