Giorgio Arena | 1f9ca1d | 2018-03-01 11:13:45 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2018 ARM Limited. |
| 3 | * |
| 4 | * SPDX-License-Identifier: MIT |
| 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | * of this software and associated documentation files (the "Software"), to |
| 8 | * deal in the Software without restriction, including without limitation the |
| 9 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
| 10 | * sell copies of the Software, and to permit persons to whom the Software is |
| 11 | * furnished to do so, subject to the following conditions: |
| 12 | * |
| 13 | * The above copyright notice and this permission notice shall be included in all |
| 14 | * copies or substantial portions of the Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
Gian Marco Iodice | 7e4b239 | 2018-02-22 16:17:20 +0000 | [diff] [blame] | 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
Giorgio Arena | 1f9ca1d | 2018-03-01 11:13:45 +0000 | [diff] [blame] | 22 | * SOFTWARE. |
| 23 | */ |
Gian Marco Iodice | 7e4b239 | 2018-02-22 16:17:20 +0000 | [diff] [blame] | 24 | #include "arm_compute/core/CL/kernels/CLWinogradFilterTransformKernel.h" |
Gian Marco Iodice | d2fab73 | 2018-03-02 11:18:12 +0000 | [diff] [blame] | 25 | #include "arm_compute/core/CL/kernels/CLWinogradOutputTransformKernel.h" |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 26 | #include "arm_compute/core/Helpers.h" |
Giorgio Arena | 1f9ca1d | 2018-03-01 11:13:45 +0000 | [diff] [blame] | 27 | #include "arm_compute/core/Types.h" |
| 28 | #include "arm_compute/core/utils/misc/ShapeCalculator.h" |
| 29 | #include "arm_compute/runtime/CL/CLTensor.h" |
| 30 | #include "arm_compute/runtime/CL/CLTensorAllocator.h" |
Gian Marco Iodice | d2fab73 | 2018-03-02 11:18:12 +0000 | [diff] [blame] | 31 | #include "arm_compute/runtime/CL/functions/CLWinogradConvolutionLayer.h" |
Giorgio Arena | 1f9ca1d | 2018-03-01 11:13:45 +0000 | [diff] [blame] | 32 | #include "arm_compute/runtime/CL/functions/CLWinogradInputTransform.h" |
| 33 | #include "tests/CL/CLAccessor.h" |
Gian Marco Iodice | 7e4b239 | 2018-02-22 16:17:20 +0000 | [diff] [blame] | 34 | #include "tests/CL/Helper.h" |
| 35 | #include "tests/PaddingCalculator.h" |
Gian Marco Iodice | d2fab73 | 2018-03-02 11:18:12 +0000 | [diff] [blame] | 36 | #include "tests/datasets/LargeConvolutionLayerDataset.h" |
Gian Marco Iodice | 7e4b239 | 2018-02-22 16:17:20 +0000 | [diff] [blame] | 37 | #include "tests/datasets/ShapeDatasets.h" |
Gian Marco Iodice | d2fab73 | 2018-03-02 11:18:12 +0000 | [diff] [blame] | 38 | #include "tests/datasets/SmallConvolutionLayerDataset.h" |
Giorgio Arena | 1f9ca1d | 2018-03-01 11:13:45 +0000 | [diff] [blame] | 39 | #include "tests/datasets/WinogradInputTransformDataset.h" |
Gian Marco Iodice | d2fab73 | 2018-03-02 11:18:12 +0000 | [diff] [blame] | 40 | #include "tests/datasets/WinogradOutputTransformDataset.h" |
Giorgio Arena | 1f9ca1d | 2018-03-01 11:13:45 +0000 | [diff] [blame] | 41 | #include "tests/framework/Asserts.h" |
| 42 | #include "tests/framework/Macros.h" |
| 43 | #include "tests/framework/datasets/Datasets.h" |
| 44 | #include "tests/validation/Validation.h" |
Georgios Pinitas | 9fb1159 | 2018-04-26 20:34:58 +0100 | [diff] [blame] | 45 | #include "tests/validation/fixtures/WinogradConvolutionLayerFixture.h" |
Giorgio Arena | 1f9ca1d | 2018-03-01 11:13:45 +0000 | [diff] [blame] | 46 | |
| 47 | namespace arm_compute |
| 48 | { |
| 49 | namespace test |
| 50 | { |
| 51 | namespace validation |
| 52 | { |
Gian Marco Iodice | 7e4b239 | 2018-02-22 16:17:20 +0000 | [diff] [blame] | 53 | namespace |
| 54 | { |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 55 | // *INDENT-OFF* |
| 56 | // clang-format off |
Gian Marco Iodice | 6cf188c | 2018-05-04 16:36:50 +0100 | [diff] [blame] | 57 | constexpr AbsoluteTolerance<float> tolerance_f32(0.001f); |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 58 | const AbsoluteTolerance<half> tolerance_f16(half(0.5f)); |
Gian Marco Iodice | 4497e81 | 2018-05-08 16:36:52 +0100 | [diff] [blame] | 59 | constexpr AbsoluteTolerance<float> tolerance_convolution_layer_f32(0.1f); |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 60 | const AbsoluteTolerance<half> tolerance_convolution_layer_f16(half(0.4f)); |
Vidhya Sudhan Loganathan | a25d16c | 2018-11-16 11:33:12 +0000 | [diff] [blame] | 61 | RelativeTolerance<half_float::half> rel_tolerance_f16(half(0.2)); /**< Tolerance value for comparing reference's output against implementation's output for FP16 data types */ |
| 62 | constexpr float tolerance_num = 0.05f; /**< Tolerance number */ |
| 63 | constexpr float abs_tolerance_convolution_layer_f16 = 2.5f; /**< Tolerance number */ |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 64 | |
| 65 | // Input transform |
| 66 | const auto SmallWinogradInputTransformDatasetNCHW = |
| 67 | framework::dataset::concat(datasets::SmallWinogradInputTransformDataset2x2_3x3(), |
| 68 | framework::dataset::concat(datasets::SmallWinogradInputTransformDataset2x1_3x1(), |
| 69 | framework::dataset::concat(datasets::SmallWinogradInputTransformDataset1x2_1x3(), |
| 70 | framework::dataset::concat(datasets::SmallWinogradInputTransformDataset4x4_3x3(), |
| 71 | framework::dataset::concat(datasets::SmallWinogradInputTransformDataset4x1_3x1(), |
| 72 | framework::dataset::concat(datasets::SmallWinogradInputTransformDataset1x4_1x3(), |
Gian Marco Iodice | 876be2a | 2018-07-03 12:22:09 +0100 | [diff] [blame] | 73 | framework::dataset::concat(datasets::SmallWinogradInputTransformDataset4x4_5x5(), |
| 74 | framework::dataset::concat(datasets::SmallWinogradInputTransformDataset4x1_5x1(), |
| 75 | datasets::SmallWinogradInputTransformDataset1x4_1x5())))))))); |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 76 | |
| 77 | const auto SmallWinogradInputTransformDatasetNHWC = framework::dataset::concat(datasets::SmallWinogradInputTransformDataset4x4_3x3(), |
Giorgio Arena | 149fdf3 | 2018-07-04 17:03:33 +0100 | [diff] [blame] | 78 | framework::dataset::concat(datasets::SmallWinogradInputTransformDataset4x1_3x1(), |
| 79 | framework::dataset::concat(datasets::SmallWinogradInputTransformDataset1x4_1x3(), |
Gian Marco Iodice | d28b751 | 2018-07-06 12:59:28 +0100 | [diff] [blame] | 80 | framework::dataset::concat(datasets::SmallWinogradInputTransformDataset4x4_5x5(), |
| 81 | framework::dataset::concat(datasets::SmallWinogradInputTransformDataset4x1_5x1(), |
| 82 | datasets::SmallWinogradInputTransformDataset1x4_1x5()))))); |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 83 | |
| 84 | const auto LargeWinogradInputTransformDatasetNCHW = |
| 85 | framework::dataset::concat(datasets::LargeWinogradInputTransformDataset2x2_3x3(), |
| 86 | framework::dataset::concat(datasets::LargeWinogradInputTransformDataset2x1_3x1(), |
| 87 | framework::dataset::concat(datasets::LargeWinogradInputTransformDataset1x2_1x3(), |
| 88 | framework::dataset::concat(datasets::LargeWinogradInputTransformDataset4x4_3x3(), |
| 89 | framework::dataset::concat(datasets::LargeWinogradInputTransformDataset4x1_3x1(), |
| 90 | framework::dataset::concat(datasets::LargeWinogradInputTransformDataset1x4_1x3(), |
Gian Marco Iodice | 876be2a | 2018-07-03 12:22:09 +0100 | [diff] [blame] | 91 | framework::dataset::concat(datasets::LargeWinogradInputTransformDataset4x4_5x5(), |
| 92 | framework::dataset::concat(datasets::LargeWinogradInputTransformDataset4x1_5x1(), |
| 93 | datasets::LargeWinogradInputTransformDataset1x4_1x5())))))))); |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 94 | |
| 95 | const auto LargeWinogradInputTransformDatasetNHWC = |
| 96 | framework::dataset::concat(datasets::LargeWinogradInputTransformDataset4x4_3x3(), |
Gian Marco Iodice | d28b751 | 2018-07-06 12:59:28 +0100 | [diff] [blame] | 97 | framework::dataset::concat(datasets::LargeWinogradInputTransformDataset4x4_5x5(), |
| 98 | framework::dataset::concat(datasets::LargeWinogradInputTransformDataset4x1_5x1(), |
| 99 | datasets::LargeWinogradInputTransformDataset1x4_1x5()))); |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 100 | |
| 101 | // Filter transform |
| 102 | const auto SmallWinogradFilterTransformDatasetNCHW = |
| 103 | framework::dataset::concat(combine(datasets::Small3x3Shapes(), framework::dataset::make("OutputTile", { Size2D(2U, 2U), Size2D(4U, 4U) })), |
| 104 | framework::dataset::concat(combine(datasets::Small3x1Shapes(), framework::dataset::make("OutputTile", { Size2D(2U, 1U), Size2D(4U, 1U) })), |
| 105 | framework::dataset::concat(combine(datasets::Small1x3Shapes(), framework::dataset::make("OutputTile", { Size2D(1U, 2U), Size2D(1U, 4U) })), |
Gian Marco Iodice | 876be2a | 2018-07-03 12:22:09 +0100 | [diff] [blame] | 106 | framework::dataset::concat(combine(datasets::Small5x5Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 4U) })), |
| 107 | framework::dataset::concat(combine(datasets::Small5x1Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 1U) })), |
| 108 | combine(datasets::Small1x5Shapes(), framework::dataset::make("OutputTile", { Size2D(1U, 4U) }))))))); |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 109 | |
| 110 | const auto SmallWinogradFilterTransformDatasetNHWC = |
| 111 | framework::dataset::concat(combine(datasets::Small3x3Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 4U) })), |
Giorgio Arena | 149fdf3 | 2018-07-04 17:03:33 +0100 | [diff] [blame] | 112 | framework::dataset::concat(combine(datasets::Small3x1Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 1U) })), |
| 113 | framework::dataset::concat(combine(datasets::Small1x3Shapes(), framework::dataset::make("OutputTile", { Size2D(1U, 4U) })), |
Gian Marco Iodice | d28b751 | 2018-07-06 12:59:28 +0100 | [diff] [blame] | 114 | framework::dataset::concat(combine(datasets::Small5x5Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 4U) })), |
| 115 | framework::dataset::concat(combine(datasets::Small5x1Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 1U) })), |
| 116 | combine(datasets::Small1x5Shapes(), framework::dataset::make("OutputTile", { Size2D(1U, 4U) }))))))); |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 117 | |
| 118 | const auto LargeWinogradFilterTransformDatasetNCHW = |
| 119 | framework::dataset::concat(combine(datasets::Large3x3Shapes(), framework::dataset::make("OutputTile", { Size2D(2U, 2U), Size2D(4U, 4U) })), |
| 120 | framework::dataset::concat(combine(datasets::Large3x1Shapes(), framework::dataset::make("OutputTile", { Size2D(2U, 1U), Size2D(4U, 1U) })), |
| 121 | framework::dataset::concat(combine(datasets::Large1x3Shapes(), framework::dataset::make("OutputTile", { Size2D(1U, 2U), Size2D(1U, 4U) })), |
Gian Marco Iodice | 876be2a | 2018-07-03 12:22:09 +0100 | [diff] [blame] | 122 | framework::dataset::concat(combine(datasets::Large5x5Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 4U) })), |
| 123 | framework::dataset::concat(combine(datasets::Large5x1Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 1U) })), |
| 124 | combine(datasets::Large1x5Shapes(), framework::dataset::make("OutputTile", { Size2D(1U, 4U) }))))))); |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 125 | |
| 126 | const auto LargeWinogradFilterTransformDatasetNHWC = |
| 127 | framework::dataset::concat(combine(datasets::Large3x3Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 4U) })), |
Gian Marco Iodice | d28b751 | 2018-07-06 12:59:28 +0100 | [diff] [blame] | 128 | framework::dataset::concat(combine(datasets::Large3x1Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 1U) })), |
| 129 | framework::dataset::concat(combine(datasets::Large1x3Shapes(), framework::dataset::make("OutputTile", { Size2D(1U, 4U) })), |
| 130 | framework::dataset::concat(combine(datasets::Large5x5Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 4U) })), |
| 131 | framework::dataset::concat(combine(datasets::Large5x1Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 1U) })), |
| 132 | combine(datasets::Large1x5Shapes(), framework::dataset::make("OutputTile", { Size2D(1U, 4U) }))))))); |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 133 | |
| 134 | // Output transform |
| 135 | const auto SmallWinogradOutputTransformDatasetNCHW = datasets::SmallWinogradOutputTransformDatasetNCHW(); |
| 136 | |
| 137 | const auto SmallWinogradOutputTransformDatasetNHWC = datasets::SmallWinogradOutputTransformDatasetNHWC(); |
| 138 | |
| 139 | const auto LargeWinogradOutputTransformDatasetNCHW = datasets::LargeWinogradOutputTransformDatasetNCHW(); |
| 140 | |
| 141 | const auto LargeWinogradOutputTransformDatasetNHWC = datasets::LargeWinogradOutputTransformDatasetNHWC(); |
Gian Marco Iodice | 7e4b239 | 2018-02-22 16:17:20 +0000 | [diff] [blame] | 142 | } // namespace |
| 143 | |
| 144 | using namespace arm_compute::misc::shape_calculator; |
| 145 | |
Giorgio Arena | 1f9ca1d | 2018-03-01 11:13:45 +0000 | [diff] [blame] | 146 | TEST_SUITE(CL) |
| 147 | TEST_SUITE(Winograd) |
| 148 | |
| 149 | TEST_SUITE(InputTransform) |
Gian Marco Iodice | 247f52c | 2018-03-22 11:24:56 +0000 | [diff] [blame] | 150 | DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip( |
Giorgio Arena | 1f9ca1d | 2018-03-01 11:13:45 +0000 | [diff] [blame] | 151 | framework::dataset::make("InputInfo",{ |
| 152 | TensorInfo(TensorShape(53U, 21U, 5U, 3U), 1, DataType::F16), // F16 not supported |
| 153 | TensorInfo(TensorShape(53U, 21U, 5U, 3U), 1, DataType::QASYMM8), // QASYMM8 not supported |
| 154 | TensorInfo(TensorShape(53U, 21U, 5U, 3U), 1, DataType::F32), // Kernel size not supported |
| 155 | TensorInfo(TensorShape(53U, 21U, 5U, 3U), 1, DataType::F32), // Strides not supported |
Gian Marco Iodice | d2fab73 | 2018-03-02 11:18:12 +0000 | [diff] [blame] | 156 | TensorInfo(TensorShape(53U, 33U, 4U), 1, DataType::F32), // Padding needed |
| 157 | TensorInfo(TensorShape(34U, 42U, 7U, 3U), 1, DataType::F32), // Padding needed |
| 158 | TensorInfo(TensorShape(31U, 37U, 37U), 1, DataType::F32) // Padding needed |
Giorgio Arena | 1f9ca1d | 2018-03-01 11:13:45 +0000 | [diff] [blame] | 159 | }), |
| 160 | framework::dataset::make("OutputInfo", { |
| 161 | TensorInfo(TensorShape(5U, 5U, 16U, 3U), 1, DataType::F16), |
| 162 | TensorInfo(TensorShape(5U, 5U, 16U, 3U), 1, DataType::QASYMM8), |
| 163 | TensorInfo(TensorShape(5U, 5U, 16U, 3U), 1, DataType::F32), |
| 164 | TensorInfo(TensorShape(5U, 1U, 16U, 3U), 1, DataType::F32), |
| 165 | TensorInfo(TensorShape(4U, 442U, 16U), 1, DataType::F32), |
| 166 | TensorInfo(TensorShape(7U, 320U, 16U, 3U), 1, DataType::F32), |
| 167 | TensorInfo(TensorShape(37U, 304U, 16U), 1, DataType::F32) |
| 168 | })), |
Gian Marco Iodice | 247f52c | 2018-03-22 11:24:56 +0000 | [diff] [blame] | 169 | framework::dataset::make("WinogradInfo", { |
| 170 | WinogradInfo(Size2D(2, 2), Size2D(3, 3), Size2D(53U, 21U), PadStrideInfo(1, 1, 1, 0), DataLayout::NCHW), |
| 171 | WinogradInfo(Size2D(2, 2), Size2D(3, 3), Size2D(53U, 21U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW), |
| 172 | WinogradInfo(Size2D(2, 2), Size2D(3, 3), Size2D(53U, 21U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW), |
| 173 | WinogradInfo(Size2D(2, 2), Size2D(3, 3), Size2D(53U, 21U), PadStrideInfo(2, 1, 1, 1), DataLayout::NCHW), |
| 174 | WinogradInfo(Size2D(2, 2), Size2D(3, 3), Size2D(53U, 33U), PadStrideInfo(1, 1, 0, 1), DataLayout::NCHW), |
| 175 | WinogradInfo(Size2D(2, 2), Size2D(3, 3), Size2D(34U, 42U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW), |
| 176 | WinogradInfo(Size2D(2, 2), Size2D(3, 3), Size2D(31U, 37U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW) |
Giorgio Arena | 1f9ca1d | 2018-03-01 11:13:45 +0000 | [diff] [blame] | 177 | })), |
Gian Marco Iodice | d2fab73 | 2018-03-02 11:18:12 +0000 | [diff] [blame] | 178 | framework::dataset::make("Expected", { false, false, false, false, false, false, false })), |
Gian Marco Iodice | 247f52c | 2018-03-22 11:24:56 +0000 | [diff] [blame] | 179 | input_info, output_info, winograd_info, expected) |
Giorgio Arena | 1f9ca1d | 2018-03-01 11:13:45 +0000 | [diff] [blame] | 180 | { |
Gian Marco Iodice | 247f52c | 2018-03-22 11:24:56 +0000 | [diff] [blame] | 181 | ARM_COMPUTE_EXPECT(bool(CLWinogradInputTransform::validate(&input_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), winograd_info)) == expected, framework::LogLevel::ERRORS); |
Giorgio Arena | 1f9ca1d | 2018-03-01 11:13:45 +0000 | [diff] [blame] | 182 | } |
Giorgio Arena | 1f9ca1d | 2018-03-01 11:13:45 +0000 | [diff] [blame] | 183 | |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 184 | using CLWinogradInputTransformFixtureFP32 = WinogradInputTransformValidationFixture<CLTensor, CLAccessor, CLWinogradInputTransform, float>; |
| 185 | using CLWinogradInputTransformFixtureFP16 = WinogradInputTransformValidationFixture<CLTensor, CLAccessor, CLWinogradInputTransform, half>; |
Giorgio Arena | 1f9ca1d | 2018-03-01 11:13:45 +0000 | [diff] [blame] | 186 | |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 187 | TEST_SUITE(NCHW) |
| 188 | DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(framework::dataset::concat(SmallWinogradInputTransformDatasetNCHW, |
| 189 | LargeWinogradInputTransformDatasetNCHW), |
Gian Marco Iodice | 247f52c | 2018-03-22 11:24:56 +0000 | [diff] [blame] | 190 | framework::dataset::make("DataLayout", { DataLayout::NCHW })), |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 191 | framework::dataset::make("DataType", { DataType::F32, DataType::F16 })), |
Gian Marco Iodice | 247f52c | 2018-03-22 11:24:56 +0000 | [diff] [blame] | 192 | shape_in, winograd_info, data_layout, data_type) |
Giorgio Arena | 1f9ca1d | 2018-03-01 11:13:45 +0000 | [diff] [blame] | 193 | { |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 194 | TensorInfo tensor_info_in(shape_in, 1, data_type); |
| 195 | tensor_info_in.set_data_layout(data_layout); |
| 196 | |
| 197 | TensorShape shape_out = compute_winograd_input_transform_shape(tensor_info_in, winograd_info); |
Giorgio Arena | 1f9ca1d | 2018-03-01 11:13:45 +0000 | [diff] [blame] | 198 | |
| 199 | // Create tensors |
Vidhya Sudhan Loganathan | 014333d | 2018-07-02 09:13:49 +0100 | [diff] [blame] | 200 | CLTensor in = create_tensor<CLTensor>(shape_in, data_type, 1, QuantizationInfo(), data_layout); |
Giorgio Arena | 1f9ca1d | 2018-03-01 11:13:45 +0000 | [diff] [blame] | 201 | CLTensor out = create_tensor<CLTensor>(shape_out, data_type); |
| 202 | |
| 203 | ARM_COMPUTE_EXPECT(in.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 204 | ARM_COMPUTE_EXPECT(out.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 205 | |
| 206 | // Create and configure function |
| 207 | CLWinogradInputTransform winograd_input_transform; |
| 208 | |
| 209 | // Configure the function |
Gian Marco Iodice | 247f52c | 2018-03-22 11:24:56 +0000 | [diff] [blame] | 210 | winograd_input_transform.configure(&in, &out, winograd_info); |
Giorgio Arena | 1f9ca1d | 2018-03-01 11:13:45 +0000 | [diff] [blame] | 211 | } |
| 212 | |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 213 | TEST_SUITE(FP32) |
| 214 | FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradInputTransformFixtureFP32, framework::DatasetMode::PRECOMMIT, combine(combine(SmallWinogradInputTransformDatasetNCHW, |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 215 | framework::dataset::make("DataLayout", { DataLayout::NCHW })), |
| 216 | framework::dataset::make("DataType", { DataType::F32 }))) |
Giorgio Arena | 1f9ca1d | 2018-03-01 11:13:45 +0000 | [diff] [blame] | 217 | { |
Giorgio Arena | fe5ef38 | 2018-04-17 10:14:10 +0100 | [diff] [blame] | 218 | validate(CLAccessor(_target), _reference, tolerance_f32); |
Giorgio Arena | 1f9ca1d | 2018-03-01 11:13:45 +0000 | [diff] [blame] | 219 | } |
| 220 | |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 221 | FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradInputTransformFixtureFP32, framework::DatasetMode::NIGHTLY, combine(combine(LargeWinogradInputTransformDatasetNCHW, |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 222 | framework::dataset::make("DataLayout", { DataLayout::NCHW })), |
| 223 | framework::dataset::make("DataType", { DataType::F32 }))) |
Giorgio Arena | 1f9ca1d | 2018-03-01 11:13:45 +0000 | [diff] [blame] | 224 | { |
Giorgio Arena | fe5ef38 | 2018-04-17 10:14:10 +0100 | [diff] [blame] | 225 | validate(CLAccessor(_target), _reference, tolerance_f32); |
Giorgio Arena | 1f9ca1d | 2018-03-01 11:13:45 +0000 | [diff] [blame] | 226 | } |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 227 | TEST_SUITE_END() // FP32 |
| 228 | |
| 229 | TEST_SUITE(FP16) |
| 230 | FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradInputTransformFixtureFP16, framework::DatasetMode::PRECOMMIT, combine(combine(SmallWinogradInputTransformDatasetNCHW, |
| 231 | framework::dataset::make("DataLayout", { DataLayout::NCHW })), |
| 232 | framework::dataset::make("DataType", { DataType::F16 }))) |
| 233 | { |
| 234 | validate(CLAccessor(_target), _reference, tolerance_f16); |
| 235 | } |
| 236 | |
| 237 | FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradInputTransformFixtureFP16, framework::DatasetMode::NIGHTLY, combine(combine(LargeWinogradInputTransformDatasetNCHW, |
| 238 | framework::dataset::make("DataLayout", { DataLayout::NCHW })), |
| 239 | framework::dataset::make("DataType", { DataType::F16 }))) |
| 240 | { |
| 241 | validate(CLAccessor(_target), _reference, tolerance_f16); |
| 242 | } |
| 243 | TEST_SUITE_END() // FP16 |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 244 | TEST_SUITE_END() // NCHW |
| 245 | |
| 246 | TEST_SUITE(NHWC) |
| 247 | DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(framework::dataset::concat(SmallWinogradInputTransformDatasetNHWC, |
| 248 | LargeWinogradInputTransformDatasetNHWC), |
| 249 | framework::dataset::make("DataLayout", { DataLayout::NHWC })), |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 250 | framework::dataset::make("DataType", { DataType::F32, DataType::F16 })), |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 251 | shape_in, winograd_info, data_layout, data_type) |
| 252 | { |
| 253 | TensorShape shape_in_nhwc(shape_in); |
| 254 | |
| 255 | // Convert the shape to NHWC |
| 256 | permute(shape_in_nhwc, PermutationVector(2U, 0U, 1U)); |
| 257 | |
| 258 | // TensorInfo |
| 259 | TensorInfo tensor_info_in(shape_in_nhwc, 1, data_type); |
| 260 | tensor_info_in.set_data_layout(data_layout); |
| 261 | |
| 262 | TensorShape shape_out = compute_winograd_input_transform_shape(tensor_info_in, winograd_info); |
| 263 | |
| 264 | // Create tensors |
Vidhya Sudhan Loganathan | 014333d | 2018-07-02 09:13:49 +0100 | [diff] [blame] | 265 | CLTensor in = create_tensor<CLTensor>(shape_in_nhwc, data_type, 1, QuantizationInfo(), data_layout); |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 266 | CLTensor out = create_tensor<CLTensor>(shape_out, data_type); |
| 267 | |
| 268 | ARM_COMPUTE_EXPECT(in.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 269 | ARM_COMPUTE_EXPECT(out.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 270 | |
| 271 | // Create and configure function |
| 272 | CLWinogradInputTransform winograd_input_transform; |
| 273 | |
| 274 | // Configure the function |
| 275 | winograd_input_transform.configure(&in, &out, winograd_info); |
| 276 | } |
| 277 | |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 278 | TEST_SUITE(FP16) |
| 279 | FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradInputTransformFixtureFP16, framework::DatasetMode::PRECOMMIT, combine(combine(SmallWinogradInputTransformDatasetNHWC, |
| 280 | framework::dataset::make("DataLayout", { DataLayout::NHWC })), |
| 281 | framework::dataset::make("DataType", { DataType::F16 }))) |
| 282 | { |
| 283 | validate(CLAccessor(_target), _reference, tolerance_f16); |
| 284 | } |
| 285 | |
| 286 | FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradInputTransformFixtureFP16, framework::DatasetMode::NIGHTLY, combine(combine(LargeWinogradInputTransformDatasetNHWC, |
| 287 | framework::dataset::make("DataLayout", { DataLayout::NHWC })), |
| 288 | framework::dataset::make("DataType", { DataType::F16 }))) |
| 289 | { |
| 290 | validate(CLAccessor(_target), _reference, tolerance_f16); |
| 291 | } |
| 292 | TEST_SUITE_END() // FP16 |
| 293 | TEST_SUITE(FP32) |
| 294 | FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradInputTransformFixtureFP32, framework::DatasetMode::PRECOMMIT, combine(combine(SmallWinogradInputTransformDatasetNHWC, |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 295 | framework::dataset::make("DataLayout", { DataLayout::NHWC })), |
| 296 | framework::dataset::make("DataType", { DataType::F32 }))) |
| 297 | { |
| 298 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 299 | } |
| 300 | |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 301 | FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradInputTransformFixtureFP32, framework::DatasetMode::NIGHTLY, combine(combine(LargeWinogradInputTransformDatasetNHWC, |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 302 | framework::dataset::make("DataLayout", { DataLayout::NHWC })), |
| 303 | framework::dataset::make("DataType", { DataType::F32 }))) |
| 304 | { |
| 305 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 306 | } |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 307 | TEST_SUITE_END() // FP32 |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 308 | TEST_SUITE_END() // NHWC |
Gian Marco Iodice | 7e4b239 | 2018-02-22 16:17:20 +0000 | [diff] [blame] | 309 | TEST_SUITE_END() // InputTransform |
Giorgio Arena | 1f9ca1d | 2018-03-01 11:13:45 +0000 | [diff] [blame] | 310 | |
Gian Marco Iodice | 7e4b239 | 2018-02-22 16:17:20 +0000 | [diff] [blame] | 311 | TEST_SUITE(FilterTransform) |
Giorgio Arena | 2d9de0a | 2018-03-15 17:58:20 +0000 | [diff] [blame] | 312 | DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip( |
Gian Marco Iodice | 7e4b239 | 2018-02-22 16:17:20 +0000 | [diff] [blame] | 313 | framework::dataset::make("InputInfo",{ |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 314 | TensorInfo(TensorShape(3U, 3U, 5U, 3U), 1, DataType::F16), // F16 supported |
Gian Marco Iodice | 7e4b239 | 2018-02-22 16:17:20 +0000 | [diff] [blame] | 315 | TensorInfo(TensorShape(3U, 3U, 5U, 3U), 1, DataType::QASYMM8), // QASYMM8 not supported |
| 316 | TensorInfo(TensorShape(5U, 5U, 5U, 3U), 1, DataType::F32), // Kernel size not supported |
Giorgio Arena | 2d9de0a | 2018-03-15 17:58:20 +0000 | [diff] [blame] | 317 | TensorInfo(TensorShape(3U, 3U), 1, DataType::F32), // Output tile not supported |
Gian Marco Iodice | 7e4b239 | 2018-02-22 16:17:20 +0000 | [diff] [blame] | 318 | TensorInfo(TensorShape(3U, 3U, 5U, 3U), 1, DataType::F32), // valid |
| 319 | TensorInfo(TensorShape(3U, 3U, 37U, 2U), 1, DataType::F32), // valid |
| 320 | TensorInfo(TensorShape(3U, 3U, 37U, 22U), 1, DataType::F32) // valid |
| 321 | }), |
| 322 | framework::dataset::make("OutputInfo", { |
| 323 | TensorInfo(TensorShape(3U, 5U, 16U), 1, DataType::F16), |
| 324 | TensorInfo(TensorShape(3U, 5U, 16U), 1, DataType::QASYMM8), |
| 325 | TensorInfo(TensorShape(3U, 5U, 16U), 1, DataType::F32), |
| 326 | TensorInfo(TensorShape(1U, 1U, 16U), 1, DataType::F32), |
| 327 | TensorInfo(TensorShape(3U, 5U, 16U), 1, DataType::F32), |
| 328 | TensorInfo(TensorShape(2U, 37U, 16U), 1, DataType::F32), |
Giorgio Arena | 2d9de0a | 2018-03-15 17:58:20 +0000 | [diff] [blame] | 329 | TensorInfo(TensorShape(22U, 37U, 36U), 1, DataType::F32) |
Gian Marco Iodice | 7e4b239 | 2018-02-22 16:17:20 +0000 | [diff] [blame] | 330 | })), |
Gian Marco Iodice | 247f52c | 2018-03-22 11:24:56 +0000 | [diff] [blame] | 331 | framework::dataset::make("WinogradInfo", { |
| 332 | WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D() /* Not needed */, PadStrideInfo() /* Not needed */, DataLayout::NCHW /* Not needed */ ), |
| 333 | WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D() /* Not needed */, PadStrideInfo() /* Not needed */, DataLayout::NCHW /* Not needed */ ), |
| 334 | WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D() /* Not needed */, PadStrideInfo() /* Not needed */, DataLayout::NCHW /* Not needed */ ), |
| 335 | WinogradInfo(Size2D(3U, 3U), Size2D(3U, 3U), Size2D() /* Not needed */, PadStrideInfo() /* Not needed */, DataLayout::NCHW /* Not needed */ ), |
| 336 | WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D() /* Not needed */, PadStrideInfo() /* Not needed */, DataLayout::NCHW /* Not needed */ ), |
| 337 | WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D() /* Not needed */, PadStrideInfo() /* Not needed */, DataLayout::NCHW /* Not needed */ ), |
| 338 | WinogradInfo(Size2D(4U, 4U), Size2D(3U, 3U), Size2D() /* Not needed */, PadStrideInfo() /* Not needed */, DataLayout::NCHW /* Not needed */ ) |
| 339 | })), |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 340 | framework::dataset::make("Expected", { true, false, false, false, true, true, true })), |
Gian Marco Iodice | 247f52c | 2018-03-22 11:24:56 +0000 | [diff] [blame] | 341 | input_info, output_info, winograd_info, expected) |
Gian Marco Iodice | 7e4b239 | 2018-02-22 16:17:20 +0000 | [diff] [blame] | 342 | { |
Gian Marco Iodice | 247f52c | 2018-03-22 11:24:56 +0000 | [diff] [blame] | 343 | ARM_COMPUTE_EXPECT(bool(CLWinogradFilterTransformKernel::validate(&input_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), winograd_info)) == expected, framework::LogLevel::ERRORS); |
Gian Marco Iodice | 7e4b239 | 2018-02-22 16:17:20 +0000 | [diff] [blame] | 344 | } |
Giorgio Arena | 1f9ca1d | 2018-03-01 11:13:45 +0000 | [diff] [blame] | 345 | |
Gian Marco Iodice | 7e4b239 | 2018-02-22 16:17:20 +0000 | [diff] [blame] | 346 | using CLWinogradFilterTransform = CLSynthetizeFunctionWithZeroConstantBorder<CLWinogradFilterTransformKernel, 0>; |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 347 | using CLWinogradFilterTransformFixtureFP32 = WinogradFilterTransformValidationFixture<CLTensor, CLAccessor, CLWinogradFilterTransform, float>; |
| 348 | using CLWinogradFilterTransformFixtureFP16 = WinogradFilterTransformValidationFixture<CLTensor, CLAccessor, CLWinogradFilterTransform, half>; |
Gian Marco Iodice | 7e4b239 | 2018-02-22 16:17:20 +0000 | [diff] [blame] | 349 | |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 350 | TEST_SUITE(NCHW) |
| 351 | DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, |
| 352 | combine(combine(framework::dataset::concat(SmallWinogradFilterTransformDatasetNCHW, |
| 353 | LargeWinogradFilterTransformDatasetNCHW), |
| 354 | framework::dataset::make("DataLayout", { DataLayout::NCHW })), |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 355 | framework::dataset::make("DataType", { DataType::F32, DataType::F16 })), |
Gian Marco Iodice | 247f52c | 2018-03-22 11:24:56 +0000 | [diff] [blame] | 356 | shape_a, output_tile, data_layout, data_type) |
Gian Marco Iodice | 7e4b239 | 2018-02-22 16:17:20 +0000 | [diff] [blame] | 357 | { |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 358 | WinogradInfo winograd_info(output_tile, Size2D(shape_a[0], shape_a[1]), Size2D() /* Not needed */, PadStrideInfo() /* Not needed */, data_layout /* Not needed */); |
Gian Marco Iodice | 7e4b239 | 2018-02-22 16:17:20 +0000 | [diff] [blame] | 359 | |
Gian Marco Iodice | 247f52c | 2018-03-22 11:24:56 +0000 | [diff] [blame] | 360 | TensorShape shape_b = compute_winograd_filter_transform_shape(TensorInfo(shape_a, 1, data_type), winograd_info); |
Gian Marco Iodice | 7e4b239 | 2018-02-22 16:17:20 +0000 | [diff] [blame] | 361 | |
| 362 | // Create tensors |
Vidhya Sudhan Loganathan | 014333d | 2018-07-02 09:13:49 +0100 | [diff] [blame] | 363 | CLTensor a = create_tensor<CLTensor>(shape_a, data_type, 1, QuantizationInfo(), data_layout); |
| 364 | CLTensor b = create_tensor<CLTensor>(shape_b, data_type, 1, QuantizationInfo(), data_layout); |
Gian Marco Iodice | 7e4b239 | 2018-02-22 16:17:20 +0000 | [diff] [blame] | 365 | |
| 366 | ARM_COMPUTE_EXPECT(a.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 367 | ARM_COMPUTE_EXPECT(b.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 368 | |
| 369 | // Create and configure function |
| 370 | CLWinogradFilterTransform winograd_filter_transform; |
Gian Marco Iodice | 247f52c | 2018-03-22 11:24:56 +0000 | [diff] [blame] | 371 | winograd_filter_transform.configure(&a, &b, winograd_info); |
Gian Marco Iodice | 7e4b239 | 2018-02-22 16:17:20 +0000 | [diff] [blame] | 372 | } |
| 373 | |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 374 | TEST_SUITE(FP32) |
| 375 | FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradFilterTransformFixtureFP32, framework::DatasetMode::PRECOMMIT, |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 376 | combine(combine(SmallWinogradFilterTransformDatasetNCHW, |
| 377 | framework::dataset::make("DataLayout", { DataLayout::NCHW })), |
| 378 | framework::dataset::make("DataType", { DataType::F32 }))) |
Gian Marco Iodice | 7e4b239 | 2018-02-22 16:17:20 +0000 | [diff] [blame] | 379 | { |
| 380 | // Validate output |
| 381 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 382 | } |
| 383 | |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 384 | FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradFilterTransformFixtureFP32, framework::DatasetMode::NIGHTLY, |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 385 | combine(combine(LargeWinogradFilterTransformDatasetNCHW, |
| 386 | framework::dataset::make("DataLayout", { DataLayout::NCHW })), |
| 387 | framework::dataset::make("DataType", { DataType::F32 }))) |
| 388 | { |
| 389 | // Validate output |
| 390 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 391 | } |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 392 | TEST_SUITE_END() // FP32 |
| 393 | TEST_SUITE(FP16) |
| 394 | FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradFilterTransformFixtureFP16, framework::DatasetMode::PRECOMMIT, |
| 395 | combine(combine(SmallWinogradFilterTransformDatasetNCHW, |
| 396 | framework::dataset::make("DataLayout", { DataLayout::NCHW })), |
| 397 | framework::dataset::make("DataType", { DataType::F16 }))) |
| 398 | { |
| 399 | // Validate output |
| 400 | validate(CLAccessor(_target), _reference, tolerance_f16); |
| 401 | } |
| 402 | |
| 403 | FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradFilterTransformFixtureFP16, framework::DatasetMode::NIGHTLY, |
| 404 | combine(combine(LargeWinogradFilterTransformDatasetNCHW, |
| 405 | framework::dataset::make("DataLayout", { DataLayout::NCHW })), |
| 406 | framework::dataset::make("DataType", { DataType::F16 }))) |
| 407 | { |
| 408 | // Validate output |
| 409 | validate(CLAccessor(_target), _reference, tolerance_f16); |
| 410 | } |
| 411 | TEST_SUITE_END() // FP16 |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 412 | TEST_SUITE_END() // NCHW |
| 413 | |
| 414 | TEST_SUITE(NHWC) |
| 415 | DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, |
| 416 | combine(combine(framework::dataset::concat(SmallWinogradFilterTransformDatasetNHWC, |
| 417 | LargeWinogradFilterTransformDatasetNHWC), |
| 418 | framework::dataset::make("DataLayout", { DataLayout::NHWC })), |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 419 | framework::dataset::make("DataType", { DataType::F32, DataType::F16 })), |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 420 | shape_in, output_tile, data_layout, data_type) |
| 421 | { |
| 422 | TensorShape shape_in_nhwc(shape_in); |
| 423 | |
| 424 | // Convert the shape to NHWC |
| 425 | permute(shape_in_nhwc, PermutationVector(2U, 0U, 1U)); |
| 426 | |
| 427 | // TensorInfo |
| 428 | TensorInfo tensor_info_in(shape_in_nhwc, 1, data_type); |
| 429 | tensor_info_in.set_data_layout(data_layout); |
| 430 | |
| 431 | WinogradInfo winograd_info(output_tile, Size2D(shape_in[0], shape_in[1]), Size2D() /* Not needed */, PadStrideInfo() /* Not needed */, data_layout /* Not needed */); |
| 432 | |
| 433 | TensorShape shape_b = compute_winograd_filter_transform_shape(tensor_info_in, winograd_info); |
| 434 | |
| 435 | // Create tensors |
Vidhya Sudhan Loganathan | 014333d | 2018-07-02 09:13:49 +0100 | [diff] [blame] | 436 | CLTensor a = create_tensor<CLTensor>(shape_in_nhwc, data_type, 1, QuantizationInfo(), data_layout); |
| 437 | CLTensor b = create_tensor<CLTensor>(shape_b, data_type, 1, QuantizationInfo(), data_layout); |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 438 | |
| 439 | ARM_COMPUTE_EXPECT(a.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 440 | ARM_COMPUTE_EXPECT(b.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 441 | |
| 442 | // Create and configure function |
| 443 | CLWinogradFilterTransform winograd_filter_transform; |
| 444 | winograd_filter_transform.configure(&a, &b, winograd_info); |
| 445 | } |
| 446 | |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 447 | TEST_SUITE(FP16) |
| 448 | FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradFilterTransformFixtureFP16, framework::DatasetMode::PRECOMMIT, |
| 449 | combine(combine(SmallWinogradFilterTransformDatasetNHWC, |
| 450 | framework::dataset::make("DataLayout", { DataLayout::NHWC })), |
| 451 | framework::dataset::make("DataType", { DataType::F16 }))) |
| 452 | { |
| 453 | // Validate output |
| 454 | validate(CLAccessor(_target), _reference, tolerance_f16); |
| 455 | } |
| 456 | |
| 457 | FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradFilterTransformFixtureFP16, framework::DatasetMode::NIGHTLY, |
| 458 | combine(combine(LargeWinogradFilterTransformDatasetNHWC, |
| 459 | framework::dataset::make("DataLayout", { DataLayout::NHWC })), |
| 460 | framework::dataset::make("DataType", { DataType::F16 }))) |
| 461 | { |
| 462 | // Validate output |
| 463 | validate(CLAccessor(_target), _reference, tolerance_f16); |
| 464 | } |
| 465 | TEST_SUITE_END() // FP16 |
| 466 | TEST_SUITE(FP32) |
| 467 | FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradFilterTransformFixtureFP32, framework::DatasetMode::PRECOMMIT, |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 468 | combine(combine(SmallWinogradFilterTransformDatasetNHWC, |
| 469 | framework::dataset::make("DataLayout", { DataLayout::NHWC })), |
| 470 | framework::dataset::make("DataType", { DataType::F32 }))) |
Gian Marco Iodice | 7e4b239 | 2018-02-22 16:17:20 +0000 | [diff] [blame] | 471 | { |
| 472 | // Validate output |
| 473 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 474 | } |
Gian Marco Iodice | d2fab73 | 2018-03-02 11:18:12 +0000 | [diff] [blame] | 475 | |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 476 | FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradFilterTransformFixtureFP32, framework::DatasetMode::NIGHTLY, |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 477 | combine(combine(LargeWinogradFilterTransformDatasetNHWC, |
| 478 | framework::dataset::make("DataLayout", { DataLayout::NHWC })), |
| 479 | framework::dataset::make("DataType", { DataType::F32 }))) |
| 480 | { |
| 481 | // Validate output |
| 482 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 483 | } |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 484 | TEST_SUITE_END() // FP32 |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 485 | TEST_SUITE_END() // NHWC |
Gian Marco Iodice | 7e4b239 | 2018-02-22 16:17:20 +0000 | [diff] [blame] | 486 | TEST_SUITE_END() // FilterTransform |
| 487 | |
Gian Marco Iodice | d2fab73 | 2018-03-02 11:18:12 +0000 | [diff] [blame] | 488 | TEST_SUITE(OutputTransform) |
Gian Marco Iodice | 247f52c | 2018-03-22 11:24:56 +0000 | [diff] [blame] | 489 | DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip( |
Gian Marco Iodice | d2fab73 | 2018-03-02 11:18:12 +0000 | [diff] [blame] | 490 | framework::dataset::make("InputInfo",{ |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 491 | TensorInfo(TensorShape(512U, 49U, 16U, 5U), 1, DataType::F16), // F16 supported |
Gian Marco Iodice | 247f52c | 2018-03-22 11:24:56 +0000 | [diff] [blame] | 492 | TensorInfo(TensorShape(512U, 49U, 16U, 5U), 1, DataType::QASYMM8), // QASYMM8 not supported |
| 493 | TensorInfo(TensorShape(512U, 49U, 16U, 5U), 1, DataType::F32), // Kernel size not supported |
| 494 | TensorInfo(TensorShape(512U, 49U, 16U, 5U), 1, DataType::F32), // Valid |
| 495 | TensorInfo(TensorShape(13U, 108U, 16U, 4U), 1, DataType::F32), // Padding needed |
| 496 | TensorInfo(TensorShape(7U, 20U, 16U, 7U), 1, DataType::F32), // Valid |
Gian Marco Iodice | e52a300 | 2018-04-11 15:59:10 +0100 | [diff] [blame] | 497 | TensorInfo(TensorShape(7U, 20U, 16U, 7U), 1, DataType::F32), // Wrong WinogradInfo |
| 498 | TensorInfo(TensorShape(7U, 256U, 36U, 3U), 1, DataType::F32), // Valid |
| 499 | TensorInfo(TensorShape(7U, 256U, 16U, 3U), 1, DataType::F32) // Wrong number of batches |
Gian Marco Iodice | d2fab73 | 2018-03-02 11:18:12 +0000 | [diff] [blame] | 500 | }), |
| 501 | framework::dataset::make("BiasInfo", { |
Gian Marco Iodice | 247f52c | 2018-03-22 11:24:56 +0000 | [diff] [blame] | 502 | TensorInfo(TensorShape(512U), 1, DataType::F16), |
| 503 | TensorInfo(TensorShape(512U), 1, DataType::QASYMM8), |
| 504 | TensorInfo(TensorShape(512U), 1, DataType::F32), |
Gian Marco Iodice | d2fab73 | 2018-03-02 11:18:12 +0000 | [diff] [blame] | 505 | TensorInfo(TensorShape(512U), 1, DataType::F32), |
| 506 | TensorInfo(TensorShape(13U), 1, DataType::F32), |
| 507 | TensorInfo(TensorShape(7U), 1, DataType::F32), |
Gian Marco Iodice | e52a300 | 2018-04-11 15:59:10 +0100 | [diff] [blame] | 508 | TensorInfo(TensorShape(7U), 1, DataType::F32), |
| 509 | TensorInfo(TensorShape(7U), 1, DataType::F32), |
Gian Marco Iodice | 247f52c | 2018-03-22 11:24:56 +0000 | [diff] [blame] | 510 | TensorInfo(TensorShape(7U), 1, DataType::F32) |
Gian Marco Iodice | d2fab73 | 2018-03-02 11:18:12 +0000 | [diff] [blame] | 511 | })), |
| 512 | framework::dataset::make("OutputInfo", { |
Gian Marco Iodice | 247f52c | 2018-03-22 11:24:56 +0000 | [diff] [blame] | 513 | TensorInfo(TensorShape(14U, 14U, 512U, 5U), 1, DataType::F16), |
| 514 | TensorInfo(TensorShape(14U, 14U, 512U, 5U), 1, DataType::QASYMM8), |
| 515 | TensorInfo(TensorShape(14U, 14U, 512U, 5U), 1, DataType::F32), |
| 516 | TensorInfo(TensorShape(14U, 14U, 512U, 5U), 1, DataType::F32), |
| 517 | TensorInfo(TensorShape(17U, 23U, 13U, 4U), 1, DataType::F32), |
| 518 | TensorInfo(TensorShape(8U, 10U, 7U, 7U), 1, DataType::F32), |
Gian Marco Iodice | e52a300 | 2018-04-11 15:59:10 +0100 | [diff] [blame] | 519 | TensorInfo(TensorShape(7U, 9U, 7U, 7U), 1, DataType::F32), |
| 520 | TensorInfo(TensorShape(64U, 64U, 7U, 3U), 1, DataType::F32), |
| 521 | TensorInfo(TensorShape(64U, 64U, 7U, 3U), 1, DataType::F32) |
Gian Marco Iodice | d2fab73 | 2018-03-02 11:18:12 +0000 | [diff] [blame] | 522 | })), |
Gian Marco Iodice | 247f52c | 2018-03-22 11:24:56 +0000 | [diff] [blame] | 523 | framework::dataset::make("WinogradInfo", { |
| 524 | WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D(14U, 14U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW), |
| 525 | WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D(14U, 14U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW), |
| 526 | WinogradInfo(Size2D(2U, 2U), Size2D(5U, 5U), Size2D(14U, 14U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW), |
| 527 | WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D(14U, 14U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW), |
| 528 | WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D(17U, 23U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW), |
| 529 | WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D(8U, 10U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW), |
| 530 | WinogradInfo(Size2D(2U, 3U), Size2D(3U, 3U), Size2D(8U, 10U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW), |
Gian Marco Iodice | e52a300 | 2018-04-11 15:59:10 +0100 | [diff] [blame] | 531 | WinogradInfo(Size2D(4U, 4U), Size2D(3U, 3U), Size2D(64U, 64U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW), |
| 532 | WinogradInfo(Size2D(4U, 4U), Size2D(3U, 3U), Size2D(64U, 64U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW) |
Gian Marco Iodice | d2fab73 | 2018-03-02 11:18:12 +0000 | [diff] [blame] | 533 | })), |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 534 | framework::dataset::make("Expected", { true, false, false, true, false, true, false, true, false })), |
Gian Marco Iodice | 247f52c | 2018-03-22 11:24:56 +0000 | [diff] [blame] | 535 | input_info, bias_info, output_info, winograd_info, expected) |
Gian Marco Iodice | d2fab73 | 2018-03-02 11:18:12 +0000 | [diff] [blame] | 536 | { |
Gian Marco Iodice | 247f52c | 2018-03-22 11:24:56 +0000 | [diff] [blame] | 537 | ARM_COMPUTE_EXPECT(bool(CLWinogradOutputTransformKernel::validate(&input_info.clone()->set_is_resizable(false), &bias_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), winograd_info)) == expected, framework::LogLevel::ERRORS); |
Gian Marco Iodice | d2fab73 | 2018-03-02 11:18:12 +0000 | [diff] [blame] | 538 | } |
Gian Marco Iodice | d2fab73 | 2018-03-02 11:18:12 +0000 | [diff] [blame] | 539 | |
| 540 | using CLWinogradOutputTransform = CLSynthetizeFunctionWithZeroConstantBorder<CLWinogradOutputTransformKernel, 0>; |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 541 | using CLWinogradOutputTransformFixtureFP32 = WinogradOutputTransformValidationFixture<CLTensor, CLAccessor, CLWinogradOutputTransform, float>; |
| 542 | using CLWinogradOutputTransformFixtureFP16 = WinogradOutputTransformValidationFixture<CLTensor, CLAccessor, CLWinogradOutputTransform, half>; |
Gian Marco Iodice | d2fab73 | 2018-03-02 11:18:12 +0000 | [diff] [blame] | 543 | |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 544 | TEST_SUITE(NCHW) |
| 545 | DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(framework::dataset::concat(SmallWinogradOutputTransformDatasetNCHW, |
| 546 | LargeWinogradOutputTransformDatasetNCHW), |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 547 | framework::dataset::make("DataType", { DataType::F32, DataType::F16 })), |
Gian Marco Iodice | 247f52c | 2018-03-22 11:24:56 +0000 | [diff] [blame] | 548 | shape_a, winograd_info, data_type) |
Gian Marco Iodice | d2fab73 | 2018-03-02 11:18:12 +0000 | [diff] [blame] | 549 | { |
Gian Marco Iodice | 247f52c | 2018-03-22 11:24:56 +0000 | [diff] [blame] | 550 | TensorShape shape_b = compute_winograd_output_transform_shape(TensorInfo(shape_a, 1, data_type), winograd_info); |
Gian Marco Iodice | d2fab73 | 2018-03-02 11:18:12 +0000 | [diff] [blame] | 551 | |
| 552 | // Create tensors |
| 553 | CLTensor a = create_tensor<CLTensor>(shape_a, data_type); |
Vidhya Sudhan Loganathan | 014333d | 2018-07-02 09:13:49 +0100 | [diff] [blame] | 554 | CLTensor b = create_tensor<CLTensor>(shape_b, data_type, 1, QuantizationInfo(), winograd_info.output_data_layout); |
Gian Marco Iodice | d2fab73 | 2018-03-02 11:18:12 +0000 | [diff] [blame] | 555 | |
| 556 | ARM_COMPUTE_EXPECT(a.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 557 | ARM_COMPUTE_EXPECT(b.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 558 | |
| 559 | // Create and configure function |
| 560 | CLWinogradOutputTransform winograd_output_transform; |
Gian Marco Iodice | 247f52c | 2018-03-22 11:24:56 +0000 | [diff] [blame] | 561 | winograd_output_transform.configure(&a, nullptr, &b, winograd_info); |
Gian Marco Iodice | d2fab73 | 2018-03-02 11:18:12 +0000 | [diff] [blame] | 562 | } |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 563 | TEST_SUITE(FP16) |
| 564 | FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradOutputTransformFixtureFP16, framework::DatasetMode::ALL, |
| 565 | combine(SmallWinogradOutputTransformDatasetNCHW, |
| 566 | framework::dataset::make("DataType", { DataType::F16 }))) |
| 567 | { |
| 568 | // Validate output |
| 569 | validate(CLAccessor(_target), _reference, tolerance_f16); |
| 570 | } |
Gian Marco Iodice | d2fab73 | 2018-03-02 11:18:12 +0000 | [diff] [blame] | 571 | |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 572 | FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradOutputTransformFixtureFP16, framework::DatasetMode::NIGHTLY, |
| 573 | combine(LargeWinogradOutputTransformDatasetNCHW, |
| 574 | framework::dataset::make("DataType", { DataType::F16 }))) |
| 575 | { |
| 576 | // Validate output |
| 577 | validate(CLAccessor(_target), _reference, tolerance_f16); |
| 578 | } |
| 579 | TEST_SUITE_END() // FP16 |
| 580 | TEST_SUITE(FP32) |
| 581 | FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradOutputTransformFixtureFP32, framework::DatasetMode::ALL, |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 582 | combine(SmallWinogradOutputTransformDatasetNCHW, |
| 583 | framework::dataset::make("DataType", { DataType::F32 }))) |
Gian Marco Iodice | d2fab73 | 2018-03-02 11:18:12 +0000 | [diff] [blame] | 584 | { |
| 585 | // Validate output |
| 586 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 587 | } |
| 588 | |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 589 | FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradOutputTransformFixtureFP32, framework::DatasetMode::NIGHTLY, |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 590 | combine(LargeWinogradOutputTransformDatasetNCHW, |
| 591 | framework::dataset::make("DataType", { DataType::F32 }))) |
| 592 | { |
| 593 | // Validate output |
| 594 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 595 | } |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 596 | TEST_SUITE_END() // FP32 |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 597 | TEST_SUITE_END() // NCHW |
| 598 | |
| 599 | TEST_SUITE(NHWC) |
| 600 | DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(framework::dataset::concat(SmallWinogradOutputTransformDatasetNHWC, |
| 601 | LargeWinogradOutputTransformDatasetNHWC), |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 602 | framework::dataset::make("DataType", { DataType::F32, DataType::F16 })), |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 603 | shape_a, winograd_info, data_type) |
| 604 | { |
| 605 | TensorShape shape_b = compute_winograd_output_transform_shape(TensorInfo(shape_a, 1, data_type), winograd_info); |
| 606 | |
| 607 | // Create tensors |
| 608 | CLTensor a = create_tensor<CLTensor>(shape_a, data_type); |
Vidhya Sudhan Loganathan | 014333d | 2018-07-02 09:13:49 +0100 | [diff] [blame] | 609 | CLTensor b = create_tensor<CLTensor>(shape_b, data_type, 1, QuantizationInfo(), winograd_info.output_data_layout); |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 610 | |
| 611 | ARM_COMPUTE_EXPECT(a.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 612 | ARM_COMPUTE_EXPECT(b.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 613 | |
| 614 | // Create and configure function |
| 615 | CLWinogradOutputTransform winograd_output_transform; |
| 616 | winograd_output_transform.configure(&a, nullptr, &b, winograd_info); |
| 617 | } |
| 618 | |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 619 | TEST_SUITE(FP16) |
| 620 | FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradOutputTransformFixtureFP16, framework::DatasetMode::ALL, |
| 621 | combine(SmallWinogradOutputTransformDatasetNHWC, |
| 622 | framework::dataset::make("DataType", { DataType::F16 }))) |
| 623 | { |
| 624 | // Validate output |
| 625 | validate(CLAccessor(_target), _reference, tolerance_f16); |
| 626 | } |
| 627 | |
| 628 | FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradOutputTransformFixtureFP16, framework::DatasetMode::NIGHTLY, |
| 629 | combine(LargeWinogradOutputTransformDatasetNHWC, |
| 630 | framework::dataset::make("DataType", { DataType::F16 }))) |
| 631 | { |
| 632 | // Validate output |
| 633 | validate(CLAccessor(_target), _reference, tolerance_f16); |
| 634 | } |
| 635 | TEST_SUITE_END() // FP16 |
| 636 | TEST_SUITE(FP32) |
| 637 | FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradOutputTransformFixtureFP32, framework::DatasetMode::ALL, |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 638 | combine(SmallWinogradOutputTransformDatasetNHWC, |
| 639 | framework::dataset::make("DataType", { DataType::F32 }))) |
Gian Marco Iodice | d2fab73 | 2018-03-02 11:18:12 +0000 | [diff] [blame] | 640 | { |
| 641 | // Validate output |
| 642 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 643 | } |
| 644 | |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 645 | FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradOutputTransformFixtureFP32, framework::DatasetMode::NIGHTLY, |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 646 | combine(LargeWinogradOutputTransformDatasetNHWC, |
| 647 | framework::dataset::make("DataType", { DataType::F32 }))) |
| 648 | { |
| 649 | // Validate output |
| 650 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 651 | } |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 652 | TEST_SUITE_END() // FP32 |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 653 | TEST_SUITE_END() // NHWC |
Gian Marco Iodice | d2fab73 | 2018-03-02 11:18:12 +0000 | [diff] [blame] | 654 | TEST_SUITE_END() // OutputTransform |
| 655 | |
| 656 | TEST_SUITE(ConvolutionLayer) |
Gian Marco Iodice | d2fab73 | 2018-03-02 11:18:12 +0000 | [diff] [blame] | 657 | DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip( |
| 658 | framework::dataset::make("InputInfo", { |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 659 | TensorInfo(TensorShape(17U, 31U, 2U), 1, DataType::F16), // Insufficient padding |
Gian Marco Iodice | d2fab73 | 2018-03-02 11:18:12 +0000 | [diff] [blame] | 660 | TensorInfo(TensorShape(17U, 31U, 2U), 1, DataType::F32), // Datatype mismatch |
| 661 | TensorInfo(TensorShape(23U, 27U, 5U, 4U), 1, DataType::F32), // Stride y not supported |
| 662 | TensorInfo(TensorShape(16U, 16U, 8U), 1, DataType::F32), // Padding needed |
| 663 | TensorInfo(TensorShape(33U, 27U, 7U, 4U), 1, DataType::F32) // Kernel size not supported |
| 664 | }), |
| 665 | framework::dataset::make("WeightsInfo", { |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 666 | TensorInfo(TensorShape(3U, 3U, 2U, 19U), 1, DataType::F16), |
Gian Marco Iodice | d2fab73 | 2018-03-02 11:18:12 +0000 | [diff] [blame] | 667 | TensorInfo(TensorShape(3U, 3U, 2U, 19U), 1, DataType::QASYMM8), |
| 668 | TensorInfo(TensorShape(3U, 3U, 5U, 21U), 1, DataType::F32), |
| 669 | TensorInfo(TensorShape(3U, 3U, 8U, 16U), 1, DataType::F32), |
| 670 | TensorInfo(TensorShape(5U, 5U, 7U, 16U), 1, DataType::F16) |
| 671 | })), |
| 672 | framework::dataset::make("BiasesInfo", { |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 673 | TensorInfo(TensorShape(19U), 1, DataType::F16), |
Gian Marco Iodice | d2fab73 | 2018-03-02 11:18:12 +0000 | [diff] [blame] | 674 | TensorInfo(TensorShape(19U), 1, DataType::F32), |
| 675 | TensorInfo(TensorShape(21U), 1, DataType::F32), |
| 676 | TensorInfo(TensorShape(16U), 1, DataType::F32), |
| 677 | TensorInfo(TensorShape(16U), 1, DataType::F32) |
| 678 | })), |
| 679 | framework::dataset::make("OutputInfo", { |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 680 | TensorInfo(TensorShape(17U, 31U, 19U), 1, DataType::F16), |
Gian Marco Iodice | d2fab73 | 2018-03-02 11:18:12 +0000 | [diff] [blame] | 681 | TensorInfo(TensorShape(15U, 15U, 19U), 1, DataType::F32), |
| 682 | TensorInfo(TensorShape(21U, 25U, 21U, 4U), 1, DataType::F32), |
| 683 | TensorInfo(TensorShape(16U, 16U, 16U), 1, DataType::F32), |
| 684 | TensorInfo(TensorShape(11U, 12U, 16U, 4U), 1, DataType::F32) |
| 685 | })), |
| 686 | framework::dataset::make("ConvInfo", { |
| 687 | PadStrideInfo(1, 1, 1, 1), |
| 688 | PadStrideInfo(1, 1, 1, 1), |
| 689 | PadStrideInfo(1, 2, 0, 0), |
| 690 | PadStrideInfo(1, 1, 1, 1), |
| 691 | PadStrideInfo(1, 1, 1, 0) |
| 692 | })), |
| 693 | framework::dataset::make("Expected", { false, false, false, false, false })), |
| 694 | input_info, weights_info, bias_info, output_info, conv_info, expected) |
| 695 | { |
| 696 | ARM_COMPUTE_EXPECT(bool(CLWinogradConvolutionLayer::validate(&input_info.clone()->set_is_resizable(false), &weights_info.clone()->set_is_resizable(false), &bias_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), conv_info)) == expected, framework::LogLevel::ERRORS); |
| 697 | } |
Gian Marco Iodice | d2fab73 | 2018-03-02 11:18:12 +0000 | [diff] [blame] | 698 | |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 699 | TEST_SUITE(FP32) |
Gian Marco Iodice | 2213d4b | 2018-04-27 10:39:06 +0100 | [diff] [blame] | 700 | using CLWinogradConvolutionLayerFastMathFixture = WinogradConvolutionLayerFastMathValidationFixture<CLTensor, CLAccessor, CLWinogradConvolutionLayer, float>; |
Gian Marco Iodice | 6cf188c | 2018-05-04 16:36:50 +0100 | [diff] [blame] | 701 | TEST_SUITE(Conv3x3) |
Gian Marco Iodice | 2213d4b | 2018-04-27 10:39:06 +0100 | [diff] [blame] | 702 | FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradConvolutionLayerFastMathFixture, framework::DatasetMode::PRECOMMIT, |
Pablo Tello | 7282d56 | 2018-06-14 15:35:49 +0100 | [diff] [blame] | 703 | combine(combine(combine(datasets::SmallWinogradConvolutionLayer3x3Dataset(), |
| 704 | framework::dataset::make("DataType", { DataType::F32 })), |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 705 | framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })), |
Giorgio Arena | ea55f91 | 2018-07-12 15:41:35 +0100 | [diff] [blame] | 706 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
Gian Marco Iodice | 2213d4b | 2018-04-27 10:39:06 +0100 | [diff] [blame] | 707 | { |
| 708 | // Validate output |
Gian Marco Iodice | 4497e81 | 2018-05-08 16:36:52 +0100 | [diff] [blame] | 709 | validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32); |
Gian Marco Iodice | 2213d4b | 2018-04-27 10:39:06 +0100 | [diff] [blame] | 710 | } |
| 711 | |
| 712 | FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradConvolutionLayerFastMathFixture, framework::DatasetMode::NIGHTLY, |
Pablo Tello | 7282d56 | 2018-06-14 15:35:49 +0100 | [diff] [blame] | 713 | combine(combine(combine(datasets::LargeWinogradConvolutionLayer3x3Dataset(), |
| 714 | framework::dataset::make("DataType", { DataType::F32 })), |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 715 | framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })), |
Giorgio Arena | ea55f91 | 2018-07-12 15:41:35 +0100 | [diff] [blame] | 716 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
Gian Marco Iodice | 2213d4b | 2018-04-27 10:39:06 +0100 | [diff] [blame] | 717 | { |
| 718 | // Validate output |
Gian Marco Iodice | 4497e81 | 2018-05-08 16:36:52 +0100 | [diff] [blame] | 719 | validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32); |
Gian Marco Iodice | 2213d4b | 2018-04-27 10:39:06 +0100 | [diff] [blame] | 720 | } |
Gian Marco Iodice | 6cf188c | 2018-05-04 16:36:50 +0100 | [diff] [blame] | 721 | TEST_SUITE_END() // Conv3x3 |
| 722 | |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 723 | TEST_SUITE(Conv3x1) |
| 724 | FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradConvolutionLayerFastMathFixture, framework::DatasetMode::PRECOMMIT, |
| 725 | combine(combine(combine(datasets::SmallWinogradConvolutionLayer3x1Dataset(), |
| 726 | framework::dataset::make("DataType", { DataType::F32 })), |
| 727 | framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })), |
Giorgio Arena | ea55f91 | 2018-07-12 15:41:35 +0100 | [diff] [blame] | 728 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 729 | { |
| 730 | // Validate output |
| 731 | validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32); |
| 732 | } |
| 733 | |
| 734 | FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradConvolutionLayerFastMathFixture, framework::DatasetMode::NIGHTLY, |
| 735 | combine(combine(combine(datasets::LargeWinogradConvolutionLayer3x1Dataset(), |
| 736 | framework::dataset::make("DataType", { DataType::F32 })), |
| 737 | framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })), |
Giorgio Arena | ea55f91 | 2018-07-12 15:41:35 +0100 | [diff] [blame] | 738 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 739 | { |
| 740 | // Validate output |
| 741 | validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32); |
| 742 | } |
| 743 | TEST_SUITE_END() // Conv3x1 |
| 744 | |
| 745 | TEST_SUITE(Conv1x3) |
| 746 | FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradConvolutionLayerFastMathFixture, framework::DatasetMode::PRECOMMIT, |
| 747 | combine(combine(combine(datasets::SmallWinogradConvolutionLayer1x3Dataset(), |
| 748 | framework::dataset::make("DataType", { DataType::F32 })), |
| 749 | framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })), |
Giorgio Arena | ea55f91 | 2018-07-12 15:41:35 +0100 | [diff] [blame] | 750 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 751 | { |
| 752 | // Validate output |
| 753 | validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32); |
| 754 | } |
| 755 | |
| 756 | FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradConvolutionLayerFastMathFixture, framework::DatasetMode::NIGHTLY, |
| 757 | combine(combine(combine(datasets::LargeWinogradConvolutionLayer1x3Dataset(), |
| 758 | framework::dataset::make("DataType", { DataType::F32 })), |
| 759 | framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })), |
Giorgio Arena | ea55f91 | 2018-07-12 15:41:35 +0100 | [diff] [blame] | 760 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 761 | { |
| 762 | // Validate output |
| 763 | validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32); |
| 764 | } |
| 765 | TEST_SUITE_END() // Conv1x3 |
| 766 | |
Gian Marco Iodice | 6cf188c | 2018-05-04 16:36:50 +0100 | [diff] [blame] | 767 | TEST_SUITE(Conv5x5) |
| 768 | FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradConvolutionLayerFastMathFixture, framework::DatasetMode::PRECOMMIT, |
Pablo Tello | 7282d56 | 2018-06-14 15:35:49 +0100 | [diff] [blame] | 769 | combine(combine(combine(datasets::SmallWinogradConvolutionLayer5x5Dataset(), |
| 770 | framework::dataset::make("DataType", { DataType::F32 })), |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 771 | framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })), |
Giorgio Arena | ea55f91 | 2018-07-12 15:41:35 +0100 | [diff] [blame] | 772 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
Pablo Tello | 7282d56 | 2018-06-14 15:35:49 +0100 | [diff] [blame] | 773 | |
Gian Marco Iodice | 6cf188c | 2018-05-04 16:36:50 +0100 | [diff] [blame] | 774 | { |
| 775 | // Validate output |
Gian Marco Iodice | 4497e81 | 2018-05-08 16:36:52 +0100 | [diff] [blame] | 776 | validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32); |
Gian Marco Iodice | 6cf188c | 2018-05-04 16:36:50 +0100 | [diff] [blame] | 777 | } |
| 778 | |
| 779 | FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradConvolutionLayerFastMathFixture, framework::DatasetMode::NIGHTLY, |
Pablo Tello | 7282d56 | 2018-06-14 15:35:49 +0100 | [diff] [blame] | 780 | combine(combine(combine(datasets::LargeWinogradConvolutionLayer5x5Dataset(), |
| 781 | framework::dataset::make("DataType", { DataType::F32 })), |
Gian Marco Iodice | f1c2bf0 | 2018-06-13 14:05:54 +0100 | [diff] [blame] | 782 | framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })), |
Giorgio Arena | ea55f91 | 2018-07-12 15:41:35 +0100 | [diff] [blame] | 783 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
Pablo Tello | 7282d56 | 2018-06-14 15:35:49 +0100 | [diff] [blame] | 784 | |
Gian Marco Iodice | 6cf188c | 2018-05-04 16:36:50 +0100 | [diff] [blame] | 785 | { |
| 786 | // Validate output |
Gian Marco Iodice | 4497e81 | 2018-05-08 16:36:52 +0100 | [diff] [blame] | 787 | validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32); |
Gian Marco Iodice | 6cf188c | 2018-05-04 16:36:50 +0100 | [diff] [blame] | 788 | } |
| 789 | TEST_SUITE_END() // Conv5x5 |
Gian Marco Iodice | 2213d4b | 2018-04-27 10:39:06 +0100 | [diff] [blame] | 790 | |
Gian Marco Iodice | 876be2a | 2018-07-03 12:22:09 +0100 | [diff] [blame] | 791 | TEST_SUITE(Conv5x1) |
| 792 | FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradConvolutionLayerFastMathFixture, framework::DatasetMode::PRECOMMIT, |
| 793 | combine(combine(combine(datasets::SmallWinogradConvolutionLayer5x1Dataset(), |
| 794 | framework::dataset::make("DataType", { DataType::F32 })), |
| 795 | framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })), |
Giorgio Arena | ea55f91 | 2018-07-12 15:41:35 +0100 | [diff] [blame] | 796 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
Gian Marco Iodice | 876be2a | 2018-07-03 12:22:09 +0100 | [diff] [blame] | 797 | |
| 798 | { |
| 799 | // Validate output |
| 800 | validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32); |
| 801 | } |
| 802 | |
| 803 | FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradConvolutionLayerFastMathFixture, framework::DatasetMode::NIGHTLY, |
| 804 | combine(combine(combine(datasets::LargeWinogradConvolutionLayer5x1Dataset(), |
| 805 | framework::dataset::make("DataType", { DataType::F32 })), |
| 806 | framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })), |
Giorgio Arena | ea55f91 | 2018-07-12 15:41:35 +0100 | [diff] [blame] | 807 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
Gian Marco Iodice | 876be2a | 2018-07-03 12:22:09 +0100 | [diff] [blame] | 808 | |
| 809 | { |
| 810 | // Validate output |
| 811 | validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32); |
| 812 | } |
| 813 | TEST_SUITE_END() // Conv5x1 |
| 814 | |
| 815 | TEST_SUITE(Conv1x5) |
| 816 | FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradConvolutionLayerFastMathFixture, framework::DatasetMode::PRECOMMIT, |
| 817 | combine(combine(combine(datasets::SmallWinogradConvolutionLayer1x5Dataset(), |
| 818 | framework::dataset::make("DataType", { DataType::F32 })), |
| 819 | framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })), |
Giorgio Arena | ea55f91 | 2018-07-12 15:41:35 +0100 | [diff] [blame] | 820 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
Gian Marco Iodice | 876be2a | 2018-07-03 12:22:09 +0100 | [diff] [blame] | 821 | |
| 822 | { |
| 823 | // Validate output |
| 824 | validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32); |
| 825 | } |
| 826 | |
| 827 | FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradConvolutionLayerFastMathFixture, framework::DatasetMode::NIGHTLY, |
| 828 | combine(combine(combine(datasets::LargeWinogradConvolutionLayer1x5Dataset(), |
| 829 | framework::dataset::make("DataType", { DataType::F32 })), |
| 830 | framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })), |
Giorgio Arena | ea55f91 | 2018-07-12 15:41:35 +0100 | [diff] [blame] | 831 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
Gian Marco Iodice | 876be2a | 2018-07-03 12:22:09 +0100 | [diff] [blame] | 832 | |
| 833 | { |
| 834 | // Validate output |
| 835 | validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32); |
| 836 | } |
| 837 | TEST_SUITE_END() // Conv1x5 |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 838 | TEST_SUITE_END() // FP32 |
| 839 | |
Vidhya Sudhan Loganathan | a25d16c | 2018-11-16 11:33:12 +0000 | [diff] [blame] | 840 | |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 841 | TEST_SUITE(FP16) |
| 842 | |
Vidhya Sudhan Loganathan | a25d16c | 2018-11-16 11:33:12 +0000 | [diff] [blame] | 843 | using CLWinogradConvolutionLayerFastMathFixture16 = WinogradConvolutionLayerFastMathValidationFixture<CLTensor, CLAccessor, CLWinogradConvolutionLayer, half, float>; |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 844 | TEST_SUITE(Conv3x3) |
| 845 | FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradConvolutionLayerFastMathFixture16, framework::DatasetMode::PRECOMMIT, |
| 846 | combine(combine(combine(datasets::SmallWinogradConvolutionLayer3x3Dataset(), |
| 847 | framework::dataset::make("DataType", { DataType::F16 })), |
| 848 | framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })), |
| 849 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 850 | { |
| 851 | // Validate output |
| 852 | validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f16); |
| 853 | } |
| 854 | |
| 855 | FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradConvolutionLayerFastMathFixture16, framework::DatasetMode::NIGHTLY, |
| 856 | combine(combine(combine(datasets::LargeWinogradConvolutionLayer3x3Dataset(), |
| 857 | framework::dataset::make("DataType", { DataType::F16 })), |
| 858 | framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })), |
| 859 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 860 | { |
| 861 | // Validate output |
Vidhya Sudhan Loganathan | a25d16c | 2018-11-16 11:33:12 +0000 | [diff] [blame] | 862 | validate(CLAccessor(_target), _reference, rel_tolerance_f16, tolerance_num, abs_tolerance_convolution_layer_f16); |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 863 | } |
| 864 | TEST_SUITE_END() // Conv3x3 |
| 865 | |
| 866 | TEST_SUITE(Conv3x1) |
| 867 | FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradConvolutionLayerFastMathFixture16, framework::DatasetMode::PRECOMMIT, |
| 868 | combine(combine(combine(datasets::SmallWinogradConvolutionLayer3x1Dataset(), |
| 869 | framework::dataset::make("DataType", { DataType::F16 })), |
| 870 | framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })), |
| 871 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 872 | { |
| 873 | // Validate output |
| 874 | validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f16); |
| 875 | } |
| 876 | |
| 877 | FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradConvolutionLayerFastMathFixture16, framework::DatasetMode::NIGHTLY, |
| 878 | combine(combine(combine(datasets::LargeWinogradConvolutionLayer3x1Dataset(), |
| 879 | framework::dataset::make("DataType", { DataType::F16 })), |
| 880 | framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })), |
| 881 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 882 | { |
| 883 | // Validate output |
Vidhya Sudhan Loganathan | a25d16c | 2018-11-16 11:33:12 +0000 | [diff] [blame] | 884 | validate(CLAccessor(_target), _reference, rel_tolerance_f16, tolerance_num, abs_tolerance_convolution_layer_f16); |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 885 | } |
| 886 | TEST_SUITE_END() // Conv3x1 |
| 887 | |
| 888 | TEST_SUITE(Conv1x3) |
| 889 | FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradConvolutionLayerFastMathFixture16, framework::DatasetMode::PRECOMMIT, |
| 890 | combine(combine(combine(datasets::SmallWinogradConvolutionLayer1x3Dataset(), |
| 891 | framework::dataset::make("DataType", { DataType::F16 })), |
| 892 | framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })), |
| 893 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 894 | { |
| 895 | // Validate output |
| 896 | validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f16); |
| 897 | } |
| 898 | |
| 899 | FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradConvolutionLayerFastMathFixture16, framework::DatasetMode::NIGHTLY, |
| 900 | combine(combine(combine(datasets::LargeWinogradConvolutionLayer1x3Dataset(), |
| 901 | framework::dataset::make("DataType", { DataType::F16 })), |
| 902 | framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })), |
| 903 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 904 | { |
| 905 | // Validate output |
Vidhya Sudhan Loganathan | a25d16c | 2018-11-16 11:33:12 +0000 | [diff] [blame] | 906 | validate(CLAccessor(_target), _reference, rel_tolerance_f16, tolerance_num, abs_tolerance_convolution_layer_f16); |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 907 | } |
| 908 | TEST_SUITE_END() // Conv1x3 |
| 909 | |
| 910 | TEST_SUITE(Conv5x5) |
| 911 | FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradConvolutionLayerFastMathFixture16, framework::DatasetMode::PRECOMMIT, |
| 912 | combine(combine(combine(datasets::SmallWinogradConvolutionLayer5x5Dataset(), |
| 913 | framework::dataset::make("DataType", { DataType::F16 })), |
| 914 | framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })), |
| 915 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 916 | |
| 917 | { |
| 918 | // Validate output |
| 919 | validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f16); |
| 920 | } |
| 921 | |
| 922 | FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradConvolutionLayerFastMathFixture16, framework::DatasetMode::NIGHTLY, |
| 923 | combine(combine(combine(datasets::LargeWinogradConvolutionLayer5x5Dataset(), |
| 924 | framework::dataset::make("DataType", { DataType::F16 })), |
| 925 | framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })), |
| 926 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 927 | |
| 928 | { |
| 929 | // Validate output |
Vidhya Sudhan Loganathan | a25d16c | 2018-11-16 11:33:12 +0000 | [diff] [blame] | 930 | validate(CLAccessor(_target), _reference, rel_tolerance_f16, tolerance_num, abs_tolerance_convolution_layer_f16); |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 931 | } |
| 932 | TEST_SUITE_END() // Conv5x5 |
| 933 | |
| 934 | TEST_SUITE(Conv5x1) |
| 935 | FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradConvolutionLayerFastMathFixture16, framework::DatasetMode::PRECOMMIT, |
| 936 | combine(combine(combine(datasets::SmallWinogradConvolutionLayer5x1Dataset(), |
| 937 | framework::dataset::make("DataType", { DataType::F16 })), |
| 938 | framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })), |
| 939 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 940 | |
| 941 | { |
| 942 | // Validate output |
| 943 | validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f16); |
| 944 | } |
| 945 | |
| 946 | FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradConvolutionLayerFastMathFixture16, framework::DatasetMode::NIGHTLY, |
| 947 | combine(combine(combine(datasets::LargeWinogradConvolutionLayer5x1Dataset(), |
| 948 | framework::dataset::make("DataType", { DataType::F16 })), |
| 949 | framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })), |
| 950 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 951 | |
| 952 | { |
| 953 | // Validate output |
Vidhya Sudhan Loganathan | a25d16c | 2018-11-16 11:33:12 +0000 | [diff] [blame] | 954 | validate(CLAccessor(_target), _reference, rel_tolerance_f16, tolerance_num, abs_tolerance_convolution_layer_f16); |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 955 | } |
| 956 | TEST_SUITE_END() // Conv5x1 |
| 957 | |
| 958 | TEST_SUITE(Conv1x5) |
| 959 | FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradConvolutionLayerFastMathFixture16, framework::DatasetMode::PRECOMMIT, |
| 960 | combine(combine(combine(datasets::SmallWinogradConvolutionLayer1x5Dataset(), |
| 961 | framework::dataset::make("DataType", { DataType::F16 })), |
| 962 | framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })), |
| 963 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 964 | |
| 965 | { |
| 966 | // Validate output |
| 967 | validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f16); |
| 968 | } |
| 969 | |
| 970 | FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradConvolutionLayerFastMathFixture16, framework::DatasetMode::NIGHTLY, |
| 971 | combine(combine(combine(datasets::LargeWinogradConvolutionLayer1x5Dataset(), |
| 972 | framework::dataset::make("DataType", { DataType::F16 })), |
| 973 | framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })), |
| 974 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 975 | |
| 976 | { |
| 977 | // Validate output |
Vidhya Sudhan Loganathan | a25d16c | 2018-11-16 11:33:12 +0000 | [diff] [blame] | 978 | validate(CLAccessor(_target), _reference, rel_tolerance_f16, tolerance_num, abs_tolerance_convolution_layer_f16); |
Vidhya Sudhan Loganathan | 71ecf39 | 2018-08-31 16:10:16 +0100 | [diff] [blame] | 979 | } |
| 980 | TEST_SUITE_END() // Conv1x5 |
| 981 | |
| 982 | TEST_SUITE_END() // FP16 |
Vidhya Sudhan Loganathan | a25d16c | 2018-11-16 11:33:12 +0000 | [diff] [blame] | 983 | |
Gian Marco Iodice | d2fab73 | 2018-03-02 11:18:12 +0000 | [diff] [blame] | 984 | TEST_SUITE_END() // ConvolutionLayer |
Gian Marco Iodice | 7e4b239 | 2018-02-22 16:17:20 +0000 | [diff] [blame] | 985 | TEST_SUITE_END() // Winograd |
| 986 | TEST_SUITE_END() // CL |
Giorgio Arena | 1f9ca1d | 2018-03-01 11:13:45 +0000 | [diff] [blame] | 987 | } // namespace validation |
| 988 | } // namespace test |
| 989 | } // namespace arm_compute |