Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 1 | /* |
Alex Gilday | 7da29b6 | 2018-03-23 14:16:00 +0000 | [diff] [blame] | 2 | * Copyright (c) 2017-2018 ARM Limited. |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 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, |
| 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 22 | * SOFTWARE. |
| 23 | */ |
Giorgio Arena | c0f5443 | 2018-03-16 14:02:34 +0000 | [diff] [blame] | 24 | #include "arm_compute/core/Helpers.h" |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 25 | #include "arm_compute/core/TensorShape.h" |
| 26 | #include "arm_compute/core/Types.h" |
Giorgio Arena | c0f5443 | 2018-03-16 14:02:34 +0000 | [diff] [blame] | 27 | #include "arm_compute/core/utils/misc/ShapeCalculator.h" |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 28 | #include "tests/AssetsLibrary.h" |
| 29 | #include "tests/Globals.h" |
| 30 | #include "tests/IAccessor.h" |
Moritz Pflanzer | a09de0c | 2017-09-01 20:41:12 +0100 | [diff] [blame] | 31 | #include "tests/framework/Asserts.h" |
| 32 | #include "tests/framework/Fixture.h" |
Moritz Pflanzer | a09de0c | 2017-09-01 20:41:12 +0100 | [diff] [blame] | 33 | #include "tests/validation/Helpers.h" |
| 34 | #include "tests/validation/fixtures/ConvolutionLayerFixture.h" |
Georgios Pinitas | 5a7e776 | 2017-12-01 16:27:29 +0000 | [diff] [blame] | 35 | #include "tests/validation/reference/ConvolutionLayer.h" |
Giorgio Arena | c0f5443 | 2018-03-16 14:02:34 +0000 | [diff] [blame] | 36 | #include "tests/validation/reference/Permute.h" |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 37 | |
| 38 | #include <random> |
| 39 | |
| 40 | namespace arm_compute |
| 41 | { |
| 42 | namespace test |
| 43 | { |
| 44 | namespace validation |
| 45 | { |
Giorgio Arena | c0f5443 | 2018-03-16 14:02:34 +0000 | [diff] [blame] | 46 | using namespace arm_compute::misc::shape_calculator; |
| 47 | |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 48 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
Chunosov | d621bca | 2017-11-03 17:33:15 +0700 | [diff] [blame] | 49 | class DirectConvolutionValidationGenericFixture : public framework::Fixture |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 50 | { |
| 51 | public: |
Georgios Pinitas | 540d008 | 2017-11-17 10:55:00 +0000 | [diff] [blame] | 52 | using TBias = typename std::conditional<std::is_same<typename std::decay<T>::type, uint8_t>::value, int32_t, T>::type; |
| 53 | |
| 54 | public: |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 55 | template <typename...> |
Chunosov | d621bca | 2017-11-03 17:33:15 +0700 | [diff] [blame] | 56 | void setup(TensorShape input_shape, int stride_x, int stride_y, int pad_x, int pad_y, unsigned int kernel_size, unsigned int num_kernels, |
Giorgio Arena | c0f5443 | 2018-03-16 14:02:34 +0000 | [diff] [blame] | 57 | DataType data_type, int fractional_bits, QuantizationInfo quantization_info, ActivationLayerInfo act_info, DataLayout data_layout) |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 58 | { |
Giorgio Arena | c0f5443 | 2018-03-16 14:02:34 +0000 | [diff] [blame] | 59 | ARM_COMPUTE_ERROR_ON(data_layout == DataLayout::UNKNOWN); |
| 60 | |
Chunosov | d621bca | 2017-11-03 17:33:15 +0700 | [diff] [blame] | 61 | _fractional_bits = fractional_bits; |
| 62 | _quantization_info = quantization_info; |
| 63 | _data_type = data_type; |
Moritz Pflanzer | cde1e8a | 2017-09-08 09:53:14 +0100 | [diff] [blame] | 64 | |
Giorgio Arena | c0f5443 | 2018-03-16 14:02:34 +0000 | [diff] [blame] | 65 | TensorShape weights_shape(kernel_size, kernel_size, input_shape.z(), num_kernels); |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 66 | const TensorShape bias_shape(num_kernels); |
| 67 | const PadStrideInfo info(stride_x, stride_y, pad_x, pad_y, DimensionRoundingType::FLOOR); |
Georgios Pinitas | 540d008 | 2017-11-17 10:55:00 +0000 | [diff] [blame] | 68 | const DataType bias_data_type = is_data_type_quantized_asymmetric(data_type) ? DataType::S32 : data_type; |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 69 | |
Giorgio Arena | c0f5443 | 2018-03-16 14:02:34 +0000 | [diff] [blame] | 70 | if(data_layout == DataLayout::NHWC) |
| 71 | { |
| 72 | permute(input_shape, PermutationVector(2U, 0U, 1U)); |
| 73 | permute(weights_shape, PermutationVector(2U, 0U, 1U)); |
| 74 | } |
| 75 | |
| 76 | TensorInfo input_info = TensorInfo(input_shape, 1, data_type, _fractional_bits); |
| 77 | TensorInfo weights_info = TensorInfo(weights_shape, 1, data_type, _fractional_bits); |
| 78 | |
| 79 | input_info.set_data_layout(data_layout); |
| 80 | weights_info.set_data_layout(data_layout); |
| 81 | |
| 82 | const TensorShape output_shape = compute_deep_convolution_shape(input_info, weights_info, info); |
| 83 | |
| 84 | _target = compute_target(input_shape, weights_shape, bias_shape, output_shape, info, data_type, bias_data_type, fractional_bits, quantization_info, act_info, data_layout); |
| 85 | _reference = compute_reference(input_shape, weights_shape, bias_shape, output_shape, info, data_type, bias_data_type, fractional_bits, quantization_info, act_info, data_layout); |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 86 | } |
| 87 | |
Jaroslaw Rzepecki | 2ecbada | 2017-11-29 13:51:34 +0000 | [diff] [blame] | 88 | template <typename...> |
Alex Gilday | 7da29b6 | 2018-03-23 14:16:00 +0000 | [diff] [blame] | 89 | void setup(TensorShape input_shape, TensorShape weights_shape, TensorShape bias_shape, TensorShape output_shape, PadStrideInfo info, Size2D dilation, |
Giorgio Arena | c0f5443 | 2018-03-16 14:02:34 +0000 | [diff] [blame] | 90 | DataType data_type, int fractional_bits, QuantizationInfo quantization_info, ActivationLayerInfo act_info, DataLayout data_layout) |
Jaroslaw Rzepecki | 2ecbada | 2017-11-29 13:51:34 +0000 | [diff] [blame] | 91 | { |
Giorgio Arena | c0f5443 | 2018-03-16 14:02:34 +0000 | [diff] [blame] | 92 | ARM_COMPUTE_ERROR_ON(data_layout == DataLayout::UNKNOWN); |
Alex Gilday | 7da29b6 | 2018-03-23 14:16:00 +0000 | [diff] [blame] | 93 | ARM_COMPUTE_UNUSED(dilation); |
| 94 | |
Jaroslaw Rzepecki | 2ecbada | 2017-11-29 13:51:34 +0000 | [diff] [blame] | 95 | _fractional_bits = fractional_bits; |
| 96 | _quantization_info = quantization_info; |
| 97 | _data_type = data_type; |
| 98 | |
| 99 | const DataType bias_data_type = is_data_type_quantized_asymmetric(data_type) ? DataType::S32 : data_type; |
| 100 | |
Giorgio Arena | c0f5443 | 2018-03-16 14:02:34 +0000 | [diff] [blame] | 101 | if(data_layout == DataLayout::NHWC) |
| 102 | { |
| 103 | permute(input_shape, PermutationVector(2U, 0U, 1U)); |
| 104 | permute(weights_shape, PermutationVector(2U, 0U, 1U)); |
| 105 | permute(output_shape, PermutationVector(2U, 0U, 1U)); |
| 106 | } |
| 107 | |
| 108 | _target = compute_target(input_shape, weights_shape, bias_shape, output_shape, info, data_type, bias_data_type, fractional_bits, quantization_info, act_info, data_layout); |
| 109 | _reference = compute_reference(input_shape, weights_shape, bias_shape, output_shape, info, data_type, bias_data_type, fractional_bits, quantization_info, act_info, data_layout); |
Jaroslaw Rzepecki | 2ecbada | 2017-11-29 13:51:34 +0000 | [diff] [blame] | 110 | } |
| 111 | |
Moritz Pflanzer | cde1e8a | 2017-09-08 09:53:14 +0100 | [diff] [blame] | 112 | protected: |
| 113 | template <typename U> |
| 114 | void fill(U &&tensor, int i) |
| 115 | { |
| 116 | switch(tensor.data_type()) |
| 117 | { |
Chunosov | d621bca | 2017-11-03 17:33:15 +0700 | [diff] [blame] | 118 | case DataType::QASYMM8: |
| 119 | { |
Georgios Pinitas | 6fdfaa8 | 2017-11-29 14:27:24 +0000 | [diff] [blame] | 120 | std::uniform_int_distribution<uint8_t> distribution(0, 50); |
Chunosov | d621bca | 2017-11-03 17:33:15 +0700 | [diff] [blame] | 121 | library->fill(tensor, distribution, i); |
| 122 | break; |
| 123 | } |
Moritz Pflanzer | cde1e8a | 2017-09-08 09:53:14 +0100 | [diff] [blame] | 124 | case DataType::F16: |
| 125 | case DataType::F32: |
| 126 | { |
| 127 | std::uniform_real_distribution<> distribution(-1.0f, 1.0f); |
| 128 | library->fill(tensor, distribution, i); |
| 129 | break; |
| 130 | } |
Dmitry Savenko | d7295b7 | 2017-11-20 22:00:08 +0700 | [diff] [blame] | 131 | case DataType::S32: |
| 132 | { |
Georgios Pinitas | 6fdfaa8 | 2017-11-29 14:27:24 +0000 | [diff] [blame] | 133 | std::uniform_int_distribution<int32_t> distribution(-5, 5); |
Dmitry Savenko | d7295b7 | 2017-11-20 22:00:08 +0700 | [diff] [blame] | 134 | library->fill(tensor, distribution, i); |
| 135 | break; |
| 136 | } |
Moritz Pflanzer | cde1e8a | 2017-09-08 09:53:14 +0100 | [diff] [blame] | 137 | default: |
| 138 | library->fill_tensor_uniform(tensor, i); |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | TensorType compute_target(const TensorShape &input_shape, const TensorShape &weights_shape, const TensorShape &bias_shape, const TensorShape &output_shape, const PadStrideInfo &info, |
Giorgio Arena | c0f5443 | 2018-03-16 14:02:34 +0000 | [diff] [blame] | 143 | DataType data_type, DataType bias_data_type, int fixed_point_position, QuantizationInfo quantization_info, ActivationLayerInfo act_info, const DataLayout &data_layout) |
Moritz Pflanzer | cde1e8a | 2017-09-08 09:53:14 +0100 | [diff] [blame] | 144 | { |
| 145 | // Create tensors |
Giorgio Arena | c0f5443 | 2018-03-16 14:02:34 +0000 | [diff] [blame] | 146 | TensorType src = create_tensor<TensorType>(input_shape, data_type, 1, fixed_point_position, quantization_info, data_layout); |
| 147 | TensorType weights = create_tensor<TensorType>(weights_shape, data_type, 1, fixed_point_position, quantization_info, data_layout); |
Georgios Pinitas | 540d008 | 2017-11-17 10:55:00 +0000 | [diff] [blame] | 148 | TensorType bias = create_tensor<TensorType>(bias_shape, bias_data_type, 1, fixed_point_position, quantization_info); |
Giorgio Arena | c0f5443 | 2018-03-16 14:02:34 +0000 | [diff] [blame] | 149 | TensorType dst = create_tensor<TensorType>(output_shape, data_type, 1, fixed_point_position, quantization_info, data_layout); |
Moritz Pflanzer | cde1e8a | 2017-09-08 09:53:14 +0100 | [diff] [blame] | 150 | |
| 151 | // Create and configure function |
| 152 | FunctionType conv; |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 153 | conv.configure(&src, &weights, &bias, &dst, info, act_info); |
Moritz Pflanzer | cde1e8a | 2017-09-08 09:53:14 +0100 | [diff] [blame] | 154 | |
| 155 | ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 156 | ARM_COMPUTE_EXPECT(weights.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 157 | ARM_COMPUTE_EXPECT(bias.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 158 | ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 159 | |
| 160 | // Allocate tensors |
| 161 | src.allocator()->allocate(); |
| 162 | weights.allocator()->allocate(); |
| 163 | bias.allocator()->allocate(); |
| 164 | dst.allocator()->allocate(); |
| 165 | |
| 166 | ARM_COMPUTE_EXPECT(!src.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 167 | ARM_COMPUTE_EXPECT(!weights.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 168 | ARM_COMPUTE_EXPECT(!bias.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 169 | ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 170 | |
| 171 | // Fill tensors |
| 172 | fill(AccessorType(src), 0); |
| 173 | fill(AccessorType(weights), 1); |
| 174 | fill(AccessorType(bias), 2); |
| 175 | |
| 176 | // Compute NEConvolutionLayer function |
| 177 | conv.run(); |
| 178 | |
| 179 | return dst; |
| 180 | } |
| 181 | |
| 182 | SimpleTensor<T> compute_reference(const TensorShape &input_shape, const TensorShape &weights_shape, const TensorShape &bias_shape, const TensorShape &output_shape, const PadStrideInfo &info, |
Giorgio Arena | c0f5443 | 2018-03-16 14:02:34 +0000 | [diff] [blame] | 183 | DataType data_type, DataType bias_data_type, int fixed_point_position, QuantizationInfo quantization_info, ActivationLayerInfo act_info, const DataLayout &data_layout) |
Moritz Pflanzer | cde1e8a | 2017-09-08 09:53:14 +0100 | [diff] [blame] | 184 | { |
Giorgio Arena | c0f5443 | 2018-03-16 14:02:34 +0000 | [diff] [blame] | 185 | ARM_COMPUTE_ERROR_ON(data_layout == DataLayout::UNKNOWN); |
| 186 | |
Moritz Pflanzer | cde1e8a | 2017-09-08 09:53:14 +0100 | [diff] [blame] | 187 | // Create reference |
Giorgio Arena | c0f5443 | 2018-03-16 14:02:34 +0000 | [diff] [blame] | 188 | SimpleTensor<T> src{ input_shape, data_type, 1, fixed_point_position, quantization_info, data_layout }; |
| 189 | SimpleTensor<T> weights{ weights_shape, data_type, 1, fixed_point_position, quantization_info, data_layout }; |
Georgios Pinitas | 540d008 | 2017-11-17 10:55:00 +0000 | [diff] [blame] | 190 | SimpleTensor<TBias> bias{ bias_shape, bias_data_type, 1, fixed_point_position, quantization_info }; |
Moritz Pflanzer | cde1e8a | 2017-09-08 09:53:14 +0100 | [diff] [blame] | 191 | |
| 192 | // Fill reference |
| 193 | fill(src, 0); |
| 194 | fill(weights, 1); |
| 195 | fill(bias, 2); |
| 196 | |
Giorgio Arena | c0f5443 | 2018-03-16 14:02:34 +0000 | [diff] [blame] | 197 | SimpleTensor<T> dst; |
| 198 | |
| 199 | // FIXME: move to reference once all functions that call reference::convolution_layer<>() support NHWC |
| 200 | if(src.data_layout() == DataLayout::NHWC) |
| 201 | { |
| 202 | SimpleTensor<T> src_nchw = reference::permute<T>(src, PermutationVector(1U, 2U, 0U)); |
| 203 | SimpleTensor<T> weights_nchw = reference::permute<T>(weights, PermutationVector(1U, 2U, 0U)); |
| 204 | |
| 205 | TensorShape output_shape_nchw{ output_shape }; |
| 206 | permute(output_shape_nchw, PermutationVector(1U, 2U, 0U)); |
| 207 | |
| 208 | dst = reference::permute<T>(reference::convolution_layer<T>(src_nchw, weights_nchw, bias, output_shape_nchw, info), PermutationVector(2U, 0U, 1U)); |
| 209 | } |
| 210 | else |
| 211 | { |
| 212 | dst = reference::convolution_layer<T>(src, weights, bias, output_shape, info); |
| 213 | } |
| 214 | |
| 215 | return (act_info.enabled()) ? reference::activation_layer<T>(dst, act_info) : dst; |
Moritz Pflanzer | cde1e8a | 2017-09-08 09:53:14 +0100 | [diff] [blame] | 216 | } |
| 217 | |
Chunosov | d621bca | 2017-11-03 17:33:15 +0700 | [diff] [blame] | 218 | TensorType _target{}; |
| 219 | SimpleTensor<T> _reference{}; |
| 220 | int _fractional_bits{}; |
| 221 | QuantizationInfo _quantization_info{}; |
| 222 | DataType _data_type{}; |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 223 | }; |
| 224 | |
| 225 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
Chunosov | d621bca | 2017-11-03 17:33:15 +0700 | [diff] [blame] | 226 | class DirectConvolutionValidationFixture : public DirectConvolutionValidationGenericFixture<TensorType, AccessorType, FunctionType, T> |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 227 | { |
| 228 | public: |
| 229 | template <typename...> |
Giorgio Arena | c0f5443 | 2018-03-16 14:02:34 +0000 | [diff] [blame] | 230 | void setup(TensorShape input_shape, int stride_x, int stride_y, int pad_x, int pad_y, unsigned int kernel_size, unsigned int num_kernels, DataType data_type, ActivationLayerInfo act_info, |
| 231 | DataLayout data_layout) |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 232 | { |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 233 | DirectConvolutionValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(input_shape, stride_x, stride_y, pad_x, pad_y, kernel_size, num_kernels, data_type, 0, QuantizationInfo(), |
Giorgio Arena | c0f5443 | 2018-03-16 14:02:34 +0000 | [diff] [blame] | 234 | act_info, data_layout); |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 235 | } |
| 236 | }; |
Chunosov | d621bca | 2017-11-03 17:33:15 +0700 | [diff] [blame] | 237 | |
| 238 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 239 | class DirectConvolutionValidationFixedPointFixture : public DirectConvolutionValidationGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 240 | { |
| 241 | public: |
| 242 | template <typename...> |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 243 | void setup(TensorShape input_shape, int stride_x, int stride_y, int pad_x, int pad_y, unsigned int kernel_size, unsigned int num_kernels, DataType data_type, int fractional_bits, |
| 244 | ActivationLayerInfo act_info) |
Chunosov | d621bca | 2017-11-03 17:33:15 +0700 | [diff] [blame] | 245 | { |
| 246 | DirectConvolutionValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(input_shape, stride_x, stride_y, pad_x, pad_y, kernel_size, num_kernels, data_type, fractional_bits, |
Giorgio Arena | c0f5443 | 2018-03-16 14:02:34 +0000 | [diff] [blame] | 247 | QuantizationInfo(), act_info, DataLayout::NCHW); |
Chunosov | d621bca | 2017-11-03 17:33:15 +0700 | [diff] [blame] | 248 | } |
| 249 | }; |
| 250 | |
| 251 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 252 | class DirectConvolutionValidationQuantizedFixture : public DirectConvolutionValidationGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 253 | { |
| 254 | public: |
| 255 | template <typename...> |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 256 | void setup(TensorShape input_shape, int stride_x, int stride_y, int pad_x, int pad_y, unsigned int kernel_size, unsigned int num_kernels, DataType data_type, QuantizationInfo quantization_info, |
| 257 | ActivationLayerInfo act_info) |
Chunosov | d621bca | 2017-11-03 17:33:15 +0700 | [diff] [blame] | 258 | { |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 259 | DirectConvolutionValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(input_shape, stride_x, stride_y, pad_x, pad_y, kernel_size, num_kernels, data_type, 0, quantization_info, |
Giorgio Arena | c0f5443 | 2018-03-16 14:02:34 +0000 | [diff] [blame] | 260 | act_info, DataLayout::NCHW); |
Chunosov | d621bca | 2017-11-03 17:33:15 +0700 | [diff] [blame] | 261 | } |
| 262 | }; |
| 263 | |
Jaroslaw Rzepecki | 2ecbada | 2017-11-29 13:51:34 +0000 | [diff] [blame] | 264 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 265 | class DirectConvolutionValidationWithTensorShapesQuantizedFixture : public DirectConvolutionValidationGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 266 | { |
| 267 | public: |
| 268 | template <typename...> |
Alex Gilday | 7da29b6 | 2018-03-23 14:16:00 +0000 | [diff] [blame] | 269 | void setup(TensorShape input_shape, TensorShape weights_shape, TensorShape bias_shape, TensorShape output_shape, PadStrideInfo info, Size2D dilation, |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 270 | DataType data_type, QuantizationInfo quantization_info, ActivationLayerInfo act_info) |
Jaroslaw Rzepecki | 2ecbada | 2017-11-29 13:51:34 +0000 | [diff] [blame] | 271 | { |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 272 | DirectConvolutionValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(input_shape, weights_shape, bias_shape, output_shape, info, dilation, data_type, 0, quantization_info, |
Giorgio Arena | c0f5443 | 2018-03-16 14:02:34 +0000 | [diff] [blame] | 273 | act_info, DataLayout::NCHW); |
Jaroslaw Rzepecki | 2ecbada | 2017-11-29 13:51:34 +0000 | [diff] [blame] | 274 | } |
| 275 | }; |
| 276 | |
| 277 | template <typename TensorType, typename AccessorType, typename FunctionType, typename T> |
| 278 | class DirectConvolutionValidationWithTensorShapesFixture : public DirectConvolutionValidationGenericFixture<TensorType, AccessorType, FunctionType, T> |
| 279 | { |
| 280 | public: |
| 281 | template <typename...> |
Alex Gilday | 7da29b6 | 2018-03-23 14:16:00 +0000 | [diff] [blame] | 282 | void setup(TensorShape input_shape, TensorShape weights_shape, TensorShape bias_shape, TensorShape output_shape, PadStrideInfo info, Size2D dilation, |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 283 | DataType data_type, ActivationLayerInfo act_info) |
Jaroslaw Rzepecki | 2ecbada | 2017-11-29 13:51:34 +0000 | [diff] [blame] | 284 | { |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 285 | DirectConvolutionValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(input_shape, weights_shape, bias_shape, output_shape, info, dilation, data_type, 0, QuantizationInfo(), |
Giorgio Arena | c0f5443 | 2018-03-16 14:02:34 +0000 | [diff] [blame] | 286 | act_info, DataLayout::NCHW); |
Jaroslaw Rzepecki | 2ecbada | 2017-11-29 13:51:34 +0000 | [diff] [blame] | 287 | } |
| 288 | }; |
| 289 | |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 290 | } // namespace validation |
| 291 | } // namespace test |
| 292 | } // namespace arm_compute |