| 32 | namespace { |
| 33 | |
| 34 | TEST_F(OpenCLOperationTest, PaddingAppendWidth) { |
| 35 | TensorFloat32 src_tensor; |
| 36 | src_tensor.shape = BHWC(1, 2, 1, 2); |
| 37 | src_tensor.data = {0.0f, 1.0f, 2.0f, 3.0f}; |
| 38 | |
| 39 | PadAttributes attr; |
| 40 | attr.prepended = HWC(0, 0, 0); |
| 41 | attr.appended = HWC(0, 1, 0); |
| 42 | |
| 43 | for (auto storage : env_.GetSupportedStorages()) { |
| 44 | for (auto precision : env_.GetSupportedPrecisions()) { |
| 45 | const float eps = precision == CalculationsPrecision::F32 ? 1e-6f : 1e-3f; |
| 46 | OperationDef op_def; |
| 47 | op_def.precision = precision; |
| 48 | auto data_type = DeduceDataTypeFromPrecision(precision); |
| 49 | op_def.src_tensors.push_back({data_type, storage}); |
| 50 | op_def.dst_tensors.push_back({data_type, storage}); |
| 51 | TensorFloat32 dst_tensor; |
| 52 | Padding operation = CreatePadding(op_def, attr); |
| 53 | ASSERT_OK(ExecuteGPUOperation(src_tensor, creation_context_, &operation, |
| 54 | BHWC(1, 2, 2, 2), &dst_tensor)); |
| 55 | EXPECT_THAT(dst_tensor.data, |
| 56 | Pointwise(FloatNear(eps), |
| 57 | {0.0f, 1.0f, 0.0f, 0.0f, 2.0f, 3.0f, 0.0f, 0.0f})); |
| 58 | } |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | TEST_F(OpenCLOperationTest, PaddingPrependWidth) { |
| 63 | TensorFloat32 src_tensor; |
nothing calls this directly
no test coverage detected