Compute Library
 21.02
CLWinogradOutputTransformKernel Class Reference

Interface for the Winograd output transform kernel. More...

#include <CLWinogradOutputTransformKernel.h>

Collaboration diagram for CLWinogradOutputTransformKernel:
[legend]

Public Member Functions

 CLWinogradOutputTransformKernel ()
 Default constructor. More...
 
 CLWinogradOutputTransformKernel (const CLWinogradOutputTransformKernel &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
CLWinogradOutputTransformKerneloperator= (const CLWinogradOutputTransformKernel &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 CLWinogradOutputTransformKernel (CLWinogradOutputTransformKernel &&)=default
 Allow instances of this class to be moved. More...
 
CLWinogradOutputTransformKerneloperator= (CLWinogradOutputTransformKernel &&)=default
 Allow instances of this class to be moved. More...
 
 ~CLWinogradOutputTransformKernel ()=default
 Default destructor. More...
 
void configure (const ICLTensor *input, const ICLTensor *bias, ICLTensor *output, const WinogradInfo &winograd_info, const ActivationLayerInfo &act_info=ActivationLayerInfo())
 Set the input and output tensor. More...
 
void configure (const CLCompileContext &compile_context, const ICLTensor *input, const ICLTensor *bias, ICLTensor *output, const WinogradInfo &winograd_info, const ActivationLayerInfo &act_info=ActivationLayerInfo())
 Set the input and output tensor. More...
 
void run (const Window &window, cl::CommandQueue &queue) override
 Enqueue the OpenCL kernel to process the given window on the passed OpenCL command queue. More...
 
- Public Member Functions inherited from ICLKernel
 ICLKernel ()
 Constructor. More...
 
cl::Kernel & kernel ()
 Returns a reference to the OpenCL kernel of this object. More...
 
template<typename T >
void add_1D_array_argument (unsigned int &idx, const ICLArray< T > *array, const Strides &strides, unsigned int num_dimensions, const Window &window)
 Add the passed 1D array's parameters to the object's kernel's arguments starting from the index idx. More...
 
void add_1D_tensor_argument (unsigned int &idx, const ICLTensor *tensor, const Window &window)
 Add the passed 1D tensor's parameters to the object's kernel's arguments starting from the index idx. More...
 
void add_1D_tensor_argument_if (bool cond, unsigned int &idx, const ICLTensor *tensor, const Window &window)
 Add the passed 1D tensor's parameters to the object's kernel's arguments starting from the index idx if the condition is true. More...
 
void add_2D_tensor_argument (unsigned int &idx, const ICLTensor *tensor, const Window &window)
 Add the passed 2D tensor's parameters to the object's kernel's arguments starting from the index idx. More...
 
void add_2D_tensor_argument_if (bool cond, unsigned int &idx, const ICLTensor *tensor, const Window &window)
 Add the passed 2D tensor's parameters to the object's kernel's arguments starting from the index idx if the condition is true. More...
 
void add_3D_tensor_argument (unsigned int &idx, const ICLTensor *tensor, const Window &window)
 Add the passed 3D tensor's parameters to the object's kernel's arguments starting from the index idx. More...
 
void add_4D_tensor_argument (unsigned int &idx, const ICLTensor *tensor, const Window &window)
 Add the passed 4D tensor's parameters to the object's kernel's arguments starting from the index idx. More...
 
virtual void run_op (ITensorPack &tensors, const Window &window, cl::CommandQueue &queue)
 Enqueue the OpenCL kernel to process the given window on the passed OpenCL command queue. More...
 
template<typename T >
void add_argument (unsigned int &idx, T value)
 Add the passed parameters to the object's kernel's arguments starting from the index idx. More...
 
void set_lws_hint (const cl::NDRange &lws_hint)
 Set the Local-Workgroup-Size hint. More...
 
cl::NDRange lws_hint () const
 Return the Local-Workgroup-Size hint. More...
 
void set_wbsm_hint (const cl_int &wbsm_hint)
 Set the workgroup batch size modifier hint. More...
 
cl_int wbsm_hint () const
 Return the workgroup batch size modifier hint. More...
 
const std::string & config_id () const
 Get the configuration ID. More...
 
void set_target (GPUTarget target)
 Set the targeted GPU architecture. More...
 
void set_target (cl::Device &device)
 Set the targeted GPU architecture according to the CL device. More...
 
GPUTarget get_target () const
 Get the targeted GPU architecture. More...
 
size_t get_max_workgroup_size ()
 Get the maximum workgroup size for the device the CLKernelLibrary uses. More...
 
template<unsigned int dimension_size>
void add_tensor_argument (unsigned &idx, const ICLTensor *tensor, const Window &window)
 
template<typename T , unsigned int dimension_size>
void add_array_argument (unsigned &idx, const ICLArray< T > *array, const Strides &strides, unsigned int num_dimensions, const Window &window)
 Add the passed array's parameters to the object's kernel's arguments starting from the index idx. More...
 
- Public Member Functions inherited from IKernel
 IKernel ()
 Constructor. More...
 
virtual ~IKernel ()=default
 Destructor. More...
 
virtual bool is_parallelisable () const
 Indicates whether or not the kernel is parallelisable. More...
 
virtual BorderSize border_size () const
 The size of the border for that kernel. More...
 
const Windowwindow () const
 The maximum window the kernel can be executed on. More...
 

Static Public Member Functions

static Status validate (const ITensorInfo *input, const ITensorInfo *bias, const ITensorInfo *output, const WinogradInfo &winograd_info, const ActivationLayerInfo &act_info=ActivationLayerInfo())
 Static function to check if given info will lead to a valid configuration of CLWinogradOutputTransformKernel. More...
 
- Static Public Member Functions inherited from ICLKernel
static constexpr unsigned int num_arguments_per_1D_array ()
 Returns the number of arguments enqueued per 1D array object. More...
 
static constexpr unsigned int num_arguments_per_1D_tensor ()
 Returns the number of arguments enqueued per 1D tensor object. More...
 
static constexpr unsigned int num_arguments_per_2D_tensor ()
 Returns the number of arguments enqueued per 2D tensor object. More...
 
static constexpr unsigned int num_arguments_per_3D_tensor ()
 Returns the number of arguments enqueued per 3D tensor object. More...
 
static constexpr unsigned int num_arguments_per_4D_tensor ()
 Returns the number of arguments enqueued per 4D tensor object. More...
 
static cl::NDRange gws_from_window (const Window &window)
 Get the global work size given an execution window. More...
 

Detailed Description

Interface for the Winograd output transform kernel.

Definition at line 34 of file CLWinogradOutputTransformKernel.h.

Constructor & Destructor Documentation

◆ CLWinogradOutputTransformKernel() [1/3]

Default constructor.

Definition at line 122 of file CLWinogradOutputTransformKernel.cpp.

123  : _input(nullptr), _bias(nullptr), _output(nullptr), _is_nhwc(false)
124 {
125 }

◆ CLWinogradOutputTransformKernel() [2/3]

Prevent instances of this class from being copied (As this class contains pointers)

◆ CLWinogradOutputTransformKernel() [3/3]

Allow instances of this class to be moved.

◆ ~CLWinogradOutputTransformKernel()

Default destructor.

Member Function Documentation

◆ configure() [1/2]

void configure ( const ICLTensor input,
const ICLTensor bias,
ICLTensor output,
const WinogradInfo winograd_info,
const ActivationLayerInfo act_info = ActivationLayerInfo() 
)

Set the input and output tensor.

Note
Winograd output transform supports the following configurations for NCWH data layout F(output tile, kernel size):F(2x2, 3x3), F(2x1, 3x1), F(1x2, 1x3), F(4x4, 3x3), F(4x1, 3x1), F(1x4, 1x3), F(4x4, 5x5), F(4x1, 5x1), F(1x4, 1x5)
Winograd output transform supports the following configurations for NHWC data layout F(output tile, kernel size):F(4x4, 3x3), F(4x1, 3x1), F(1x4, 1x3), F(4x4, 5x5), F(4x1, 5x1), F(1x4, 1x5)

Strides: only unit strides

Parameters
[in]inputSource tensor with shape [C, N, K, batches]. Data types supported: F16/F32.
[in]biasBiases tensor. Shared biases supported. Biases are 1D tensor with dimensions [OFM]. It can be a nullptr. Data type supported: as input
[out]outputThe output tensor. The shape for this tensor can be calculated using the utility function compute_winograd_output_transform_shape. Data types supported: Same as input
[in]winograd_infoContains Winograd's information described in WinogradInfo
[in]act_info(Optional) Activation layer information in case of a fused activation.

Definition at line 127 of file CLWinogradOutputTransformKernel.cpp.

References CLKernelLibrary::get().

128 {
129  configure(CLKernelLibrary::get().get_compile_context(), input, bias, output, winograd_info, act_info);
130 }
static CLKernelLibrary & get()
Access the KernelLibrary singleton.
void configure(const ICLTensor *input, const ICLTensor *bias, ICLTensor *output, const WinogradInfo &winograd_info, const ActivationLayerInfo &act_info=ActivationLayerInfo())
Set the input and output tensor.

◆ configure() [2/2]

void configure ( const CLCompileContext compile_context,
const ICLTensor input,
const ICLTensor bias,
ICLTensor output,
const WinogradInfo winograd_info,
const ActivationLayerInfo act_info = ActivationLayerInfo() 
)

Set the input and output tensor.

Note
Winograd output transform supports the following configurations for NCWH data layout F(output tile, kernel size):F(2x2, 3x3), F(2x1, 3x1), F(1x2, 1x3), F(4x4, 3x3), F(4x1, 3x1), F(1x4, 1x3), F(4x4, 5x5), F(4x1, 5x1), F(1x4, 1x5)
Winograd output transform supports the following configurations for NHWC data layout F(output tile, kernel size):F(4x4, 3x3), F(4x1, 3x1), F(1x4, 1x3), F(4x4, 5x5), F(4x1, 5x1), F(1x4, 1x5)

Strides: only unit strides

Parameters
[in]compile_contextThe compile context to be used.
[in]inputSource tensor with shape [C, N, K, batches]. Data types supported: F16/F32.
[in]biasBiases tensor. Shared biases supported. Biases are 1D tensor with dimensions [OFM]. It can be a nullptr. Data type supported: as input
[out]outputThe output tensor. The shape for this tensor can be calculated using the utility function compute_winograd_output_transform_shape. Data types supported: Same as input
[in]winograd_infoContains Winograd's information described in WinogradInfo
[in]act_info(Optional) Activation layer information in case of a fused activation.

Definition at line 132 of file CLWinogradOutputTransformKernel.cpp.

References ActivationLayerInfo::a(), ActivationLayerInfo::activation(), CLBuildOptions::add_option(), CLBuildOptions::add_option_if(), ARM_COMPUTE_ERROR_ON, ARM_COMPUTE_ERROR_ON_NULLPTR, ARM_COMPUTE_ERROR_THROW_ON, arm_compute::auto_init_if_empty(), ActivationLayerInfo::b(), ICloneable< T >::clone(), arm_compute::compute_winograd_convolution_tiles(), arm_compute::misc::shape_calculator::compute_winograd_output_transform_shape(), WinogradInfo::convolution_info, arm_compute::create_kernel(), ITensorInfo::data_type(), ITensorInfo::dimension(), ActivationLayerInfo::enabled(), arm_compute::float_to_string_with_full_precision(), arm_compute::get_cl_type_from_data_type(), arm_compute::get_data_layout_dimension_index(), arm_compute::get_padding_info(), arm_compute::has_padding_changed(), Size2D::height, arm_compute::HEIGHT, arm_compute::test::validation::idx_height, arm_compute::test::validation::idx_width, ITensor::info(), arm_compute::test::validation::input, WinogradInfo::input_dimensions, kernel_name, WinogradInfo::kernel_size, arm_compute::lower_string(), arm_compute::NHWC, CLBuildOptions::options(), WinogradInfo::output_data_layout, WinogradInfo::output_tile_size, arm_compute::string_from_activation_func(), arm_compute::string_from_data_layout(), arm_compute::string_from_data_type(), ITensorInfo::tensor_shape(), Size2D::to_string(), arm_compute::support::cpp11::to_string(), TensorShape::total_size_upper(), arm_compute::validate_arguments(), Size2D::width, arm_compute::WIDTH, arm_compute::test::validation::winograd_info, Size2D::x(), and Size2D::y().

134 {
136 
137  // Output tensor auto initialization if not yet initialized
138  auto_init_if_empty(*output->info(), input->info()->clone()->set_tensor_shape(compute_winograd_output_transform_shape(*input->info(), winograd_info)));
139 
140  ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input->info(), (bias != nullptr ? bias->info() : nullptr), output->info(), winograd_info, act_info));
141 
142  auto padding_info = get_padding_info({ input, bias, output });
143 
144  _input = input;
145  _bias = bias;
146  _output = output;
147  _is_nhwc = winograd_info.output_data_layout == DataLayout::NHWC;
148 
149  // Compute num_tiles_x
150  const Size2D input_dimensions = winograd_info.input_dimensions;
151  const Size2D kernel_size = winograd_info.kernel_size;
152  const Size2D output_tile_size = winograd_info.output_tile_size;
153  const PadStrideInfo conv_info = winograd_info.convolution_info;
156 
157  // Compute the number of output tiles along the x and y direction of size "output_tile_size"
158  const Size2D num_tiles = compute_winograd_convolution_tiles(input_dimensions,
159  kernel_size,
160  output_tile_size,
161  conv_info);
162  const size_t total_batches = output->info()->tensor_shape().total_size_upper(3);
163 
164  // Set build options
165  CLBuildOptions build_opts;
166  build_opts.add_option("-DACTIVATION_TYPE=" + lower_string(string_from_activation_func(act_info.activation())));
167  build_opts.add_option_if(act_info.enabled(), "-DA_VAL=" + float_to_string_with_full_precision(act_info.a()));
168  build_opts.add_option_if(act_info.enabled(), "-DB_VAL=" + float_to_string_with_full_precision(act_info.b()));
169 
170  if((output_tile_size.x() == 2) || (output_tile_size.x() == 1 && output_tile_size.y() == 2))
171  {
172  build_opts.add_option("-DVEC_SIZE=2");
173  }
174  else if((output_tile_size.x() == 4) || (output_tile_size.x() == 1 && output_tile_size.y() == 4))
175  {
176  build_opts.add_option("-DVEC_SIZE=4");
177  }
178 
179  build_opts.add_option_if(_bias != nullptr, std::string("-DHAS_BIAS"));
180  build_opts.add_option("-DNUM_TILES_X=" + support::cpp11::to_string(num_tiles.width));
181  build_opts.add_option("-DOUTPUT_TILE_W=" + support::cpp11::to_string(output_tile_size.width));
182  build_opts.add_option("-DOUTPUT_TILE_H=" + support::cpp11::to_string(output_tile_size.height));
183  build_opts.add_option("-DDATA_TYPE=" + get_cl_type_from_data_type(input->info()->data_type()));
184  build_opts.add_option("-DDST_WIDTH=" + support::cpp11::to_string(_output->info()->dimension(idx_width)));
185  build_opts.add_option("-DDST_HEIGHT=" + support::cpp11::to_string(_output->info()->dimension(idx_height)));
186  build_opts.add_option_if(total_batches > 1, "-DSRC_DEPTH=" + support::cpp11::to_string(_input->info()->dimension(2)));
187  build_opts.add_option_if(winograd_info.kernel_size.height == 1, "-DWINOGRAD_OUTPUT_TRANSFORM_HORIZONTAL");
188  build_opts.add_option_if(winograd_info.kernel_size.width == 1, "-DWINOGRAD_OUTPUT_TRANSFORM_VERTICAL");
189 
190  // Create kernel
191  std::string kernel_name = "winograd_output_transform_" + output_tile_size.to_string() + "_" + kernel_size.to_string() + "_" + lower_string(string_from_data_layout(winograd_info.output_data_layout));
192  _kernel = create_kernel(compile_context, kernel_name, build_opts.options());
193 
194  // Configure kernel window
195  auto win_config = validate_and_configure_window(input->info(), (bias != nullptr ? bias->info() : nullptr), output->info(), winograd_info.output_tile_size);
196  ARM_COMPUTE_ERROR_THROW_ON(win_config.first);
197  ICLKernel::configure_internal(win_config.second);
198 
199  // Set config_id for enabling LWS tuning
200  _config_id = kernel_name;
201  _config_id += "_";
202  _config_id += lower_string(string_from_data_type(input->info()->data_type()));
203  _config_id += "_";
204  _config_id += support::cpp11::to_string(input->info()->dimension(0));
205  _config_id += "_";
206  _config_id += support::cpp11::to_string(input->info()->dimension(1));
207  _config_id += "_";
208  _config_id += support::cpp11::to_string(output->info()->dimension(0));
209  _config_id += "_";
210  _config_id += support::cpp11::to_string(output->info()->dimension(1));
211  _config_id += "_";
212  _config_id += lower_string(string_from_data_layout(winograd_info.output_data_layout));
213 
214  ARM_COMPUTE_ERROR_ON(has_padding_changed(padding_info) && _is_nhwc);
215 }
virtual size_t dimension(size_t index) const =0
Return the size of the requested dimension.
std::string to_string(T &&value)
Convert integer and float values to string.
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466
const std::string & string_from_activation_func(ActivationLayerInfo::ActivationFunction act)
Translates a given activation function to a string.
Definition: Utils.cpp:163
#define ARM_COMPUTE_ERROR_THROW_ON(status)
Definition: Error.h:455
Size2D compute_winograd_convolution_tiles(const Size2D &in_dims, const Size2D &kernel_size, const Size2D &output_tile_size, const PadStrideInfo &conv_info)
Calculate the number of output tiles required by Winograd Convolution layer.
Definition: Helpers.h:211
std::string lower_string(const std::string &val)
Lower a given string.
Definition: Utils.cpp:350
cl::Kernel create_kernel(const CLCompileContext &ctx, const std::string &kernel_name, const std::set< std::string > &build_opts=std::set< std::string >())
Creates an opencl kernel using a compile context.
Definition: CLHelpers.cpp:403
const std::string & string_from_data_type(DataType dt)
Convert a data type identity into a string.
Definition: Utils.cpp:135
std::string float_to_string_with_full_precision(float val)
Create a string with the float in full precision.
Definition: Utils.h:1262
std::string kernel_name
std::string get_cl_type_from_data_type(const DataType &dt)
Translates a tensor data type to the appropriate OpenCL type.
Definition: CLHelpers.cpp:37
bool auto_init_if_empty(ITensorInfo &info, const TensorShape &shape, int num_channels, DataType data_type, QuantizationInfo quantization_info=QuantizationInfo())
Auto initialize the tensor info (shape, number of channels and data type) if the current assignment i...
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor&#39;s metadata.
bool has_padding_changed(const std::unordered_map< const ITensorInfo *, PaddingSize > &padding_map)
Check if the previously stored padding info has changed after configuring a kernel.
Definition: Utils.cpp:528
const std::string & string_from_data_layout(DataLayout dl)
Convert a data layout identity into a string.
Definition: Utils.cpp:123
TensorShape compute_winograd_output_transform_shape(const ITensorInfo &input, const WinogradInfo &winograd_info)
Calculate the winograd output transform shape.
Num samples, height, width, channels.
std::unordered_map< const ITensorInfo *, PaddingSize > get_padding_info(std::initializer_list< const ITensorInfo *> infos)
Stores padding information before configuring a kernel.
Definition: Utils.cpp:513
Status validate_arguments(const ITensorInfo *input, const ITensorInfo *bias, const ITensorInfo *output, const GEMMLowpOutputStageInfo *output_stage)
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Definition: Validate.h:161
size_t get_data_layout_dimension_index(const DataLayout data_layout, const DataLayoutDimension data_layout_dimension)
Get the index of the given dimension.
Definition: Helpers.inl:193

◆ operator=() [1/2]

Prevent instances of this class from being copied (As this class contains pointers)

◆ operator=() [2/2]

Allow instances of this class to be moved.

◆ run()

void run ( const Window window,
cl::CommandQueue &  queue 
)
overridevirtual

Enqueue the OpenCL kernel to process the given window on the passed OpenCL command queue.

Note
The queue is not flushed by this method, and therefore the kernel will not have been executed by the time this method returns.
Parameters
[in]windowRegion on which to execute the kernel. (Must be a valid region of the window returned by window()).
[in,out]queueCommand queue on which to enqueue the kernel.

Reimplemented from ICLKernel.

Definition at line 225 of file CLWinogradOutputTransformKernel.cpp.

References ICLKernel::add_1D_tensor_argument(), ICLKernel::add_4D_tensor_argument(), ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW, ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL, Window::collapse_if_possible(), Window::DimX, Window::DimY, Window::DimZ, arm_compute::enqueue(), Window::first_slice_window_4D(), ITensor::info(), ICLKernel::lws_hint(), ICLKernel::num_arguments_per_1D_tensor(), ICLKernel::num_arguments_per_4D_tensor(), Window::set(), arm_compute::test::validation::reference::slice(), Window::slide_window_slice_3D(), ITensorInfo::strides_in_bytes(), ITensorInfo::tensor_shape(), ITensorInfo::total_size(), Window::use_tensor_dimensions(), IKernel::window(), and Dimensions< T >::y().

226 {
229 
230  // Collapse window
231  Window window_collapsed = window.collapse_if_possible(ICLKernel::window(), Window::DimZ);
232 
233  // Get initial windows
234  Window slice = window_collapsed.first_slice_window_4D();
235  slice.set(Window::DimZ, Window::Dimension(0, 1, 1));
236 
237  // Setup output slice
238  Window slice_out(slice);
239  slice_out.set(Window::DimX, Window::Dimension(0, 0, 0));
240  slice_out.set(Window::DimY, Window::Dimension(0, 0, 0));
241 
242  if(_bias != nullptr)
243  {
244  unsigned int idx1 = 2 * num_arguments_per_4D_tensor();
245  Window slice_biases;
246  slice_biases.use_tensor_dimensions(_bias->info()->tensor_shape());
247  add_1D_tensor_argument(idx1, _bias, slice_biases);
248  }
249 
250  if(_is_nhwc)
251  {
252  unsigned int idx2 = 2 * num_arguments_per_4D_tensor() + ((_bias != nullptr) ? num_arguments_per_1D_tensor() : 0);
253  _kernel.setArg(idx2, static_cast<int>(_output->info()->total_size() - _output->info()->strides_in_bytes().y()));
254  }
255 
256  do
257  {
258  unsigned int idx = 0;
259  add_4D_tensor_argument(idx, _input, slice);
260  add_4D_tensor_argument(idx, _output, slice_out);
261  enqueue(queue, *this, slice, lws_hint());
262  }
263  while(window.slide_window_slice_3D(slice) && window.slide_window_slice_3D(slice_out));
264 }
static constexpr unsigned int num_arguments_per_1D_tensor()
Returns the number of arguments enqueued per 1D tensor object.
Definition: ICLKernel.h:198
const Window & window() const
The maximum window the kernel can be executed on.
Definition: IKernel.cpp:28
void enqueue(IGCKernel &kernel, const Window &window, const gles::NDRange &lws=gles::NDRange(1U, 1U, 1U))
Add the kernel to the command queue with the given window.
Definition: IGCKernel.cpp:41
cl::NDRange lws_hint() const
Return the Local-Workgroup-Size hint.
Definition: ICLKernel.h:276
static constexpr size_t DimX
Alias for dimension 0 also known as X dimension.
Definition: Window.h:43
Window collapse_if_possible(const Window &full_window, size_t first, size_t last, bool *has_collapsed=nullptr) const
Collapse the dimensions between first and last if possible.
Definition: Window.inl:68
virtual const TensorShape & tensor_shape() const =0
Size for each dimension of the tensor.
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor&#39;s metadata.
static constexpr unsigned int num_arguments_per_4D_tensor()
Returns the number of arguments enqueued per 4D tensor object.
Definition: ICLKernel.h:222
bool slide_window_slice_3D(Window &slice) const
Slide the passed 3D window slice.
Definition: Window.h:335
#define ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(k)
Definition: Validate.h:941
static constexpr size_t DimY
Alias for dimension 1 also known as Y dimension.
Definition: Window.h:45
virtual size_t total_size() const =0
Returns the total size of the tensor in bytes.
static constexpr size_t DimZ
Alias for dimension 2 also known as Z dimension.
Definition: Window.h:47
T y() const
Alias to access the size of the second dimension.
Definition: Dimensions.h:92
virtual const Strides & strides_in_bytes() const =0
The strides in bytes for accessing each dimension of the tensor.
void add_1D_tensor_argument(unsigned int &idx, const ICLTensor *tensor, const Window &window)
Add the passed 1D tensor&#39;s parameters to the object&#39;s kernel&#39;s arguments starting from the index idx...
Definition: ICLKernel.h:124
void add_4D_tensor_argument(unsigned int &idx, const ICLTensor *tensor, const Window &window)
Add the passed 4D tensor&#39;s parameters to the object&#39;s kernel&#39;s arguments starting from the index idx...
Definition: ICLKernel.h:182
#define ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(f, s)
Definition: Validate.h:205
SimpleTensor< T > slice(const SimpleTensor< T > &src, Coordinates starts, Coordinates ends)

◆ validate()

Status validate ( const ITensorInfo input,
const ITensorInfo bias,
const ITensorInfo output,
const WinogradInfo winograd_info,
const ActivationLayerInfo act_info = ActivationLayerInfo() 
)
static

Static function to check if given info will lead to a valid configuration of CLWinogradOutputTransformKernel.

Note
Winograd output transform supports the following configurations for NCWH data layout F(output tile, kernel size):F(2x2, 3x3), F(2x1, 3x1), F(1x2, 1x3), F(4x4, 3x3), F(4x1, 3x1), F(1x4, 1x3), F(4x4, 5x5), F(4x1, 5x1), F(1x4, 1x5)
Winograd output transform supports the following configurations for NHWC data layout F(output tile, kernel size):F(4x4, 3x3), F(4x1, 3x1), F(1x4, 1x3), F(4x4, 5x5), F(4x1, 5x1), F(1x4, 1x5)

Strides: only unit strides

Parameters
[in]inputSource tensor with shape [C, N, K, batches]. Data types supported: F16/F32.
[in]biasBiases tensor. Shared biases supported. Biases are 1D tensor with dimensions [OFM]. It can be a nullptr. Data type supported: as input
[out]outputThe output tensor. The shape for this tensor can be calculated using the utility function compute_winograd_output_transform_shape. Data types supported: Same as input
[in]winograd_infoContains Winograd's information described in WinogradInfo
[in]act_info(Optional) Activation layer information in case of a fused activation ActivationLayerInfo. Only RELU, BOUNDED_RELU, LU_BOUNDED_RELU, LEAKY_RELU and SOFT_RELU supported.
Returns
a status

Definition at line 217 of file CLWinogradOutputTransformKernel.cpp.

References ARM_COMPUTE_RETURN_ON_ERROR, ICloneable< T >::clone(), WinogradInfo::output_tile_size, and arm_compute::validate_arguments().

Referenced by CLWinogradConvolutionLayer::validate().

218 {
219  ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(input, (bias != nullptr ? bias->clone().get() : nullptr), output, winograd_info, act_info));
220  ARM_COMPUTE_RETURN_ON_ERROR(validate_and_configure_window(input->clone().get(), (bias != nullptr ? bias->clone().get() : nullptr), output->clone().get(), winograd_info.output_tile_size).first);
221 
222  return Status{};
223 }
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Definition: Error.h:204
Status validate_arguments(const ITensorInfo *input, const ITensorInfo *bias, const ITensorInfo *output, const GEMMLowpOutputStageInfo *output_stage)

The documentation for this class was generated from the following files: