Compute Library
 21.02
CLWinogradInputTransformKernel Class Reference

OpenCL kernel to perform Winograd input transform. More...

#include <CLWinogradInputTransformKernel.h>

Collaboration diagram for CLWinogradInputTransformKernel:
[legend]

Public Member Functions

 CLWinogradInputTransformKernel ()
 Default constructor. More...
 
 CLWinogradInputTransformKernel (const CLWinogradInputTransformKernel &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
CLWinogradInputTransformKerneloperator= (const CLWinogradInputTransformKernel &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 CLWinogradInputTransformKernel (CLWinogradInputTransformKernel &&)=default
 Allow instances of this class to be moved. More...
 
CLWinogradInputTransformKerneloperator= (CLWinogradInputTransformKernel &&)=default
 Allow instances of this class to be moved. More...
 
void configure (const ICLTensor *input, ICLTensor *output, const WinogradInfo &winograd_info)
 Set the input and output of the kernel. More...
 
void configure (const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output, const WinogradInfo &winograd_info)
 Set the input and output of the kernel. 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...
 
BorderSize border_size () const override
 The size of the border for that kernel. 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...
 
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 *output, const WinogradInfo &winograd_info)
 Static function to check if given info will lead to a valid configuration of CLWinogradInputTransformKernel. 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

OpenCL kernel to perform Winograd input transform.

Definition at line 34 of file CLWinogradInputTransformKernel.h.

Constructor & Destructor Documentation

◆ CLWinogradInputTransformKernel() [1/3]

Default constructor.

Definition at line 98 of file CLWinogradInputTransformKernel.cpp.

99  : _border_size(0), _input(nullptr), _output(nullptr), _data_layout(DataLayout::UNKNOWN), _num_tiles_x(0), _num_tiles_y(0), _step_z(1)
100 {
101 }

◆ CLWinogradInputTransformKernel() [2/3]

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

◆ CLWinogradInputTransformKernel() [3/3]

Allow instances of this class to be moved.

Member Function Documentation

◆ border_size()

BorderSize border_size ( ) const
overridevirtual

The size of the border for that kernel.

Returns
The width in number of elements of the border.

Reimplemented from IKernel.

Definition at line 103 of file CLWinogradInputTransformKernel.cpp.

104 {
105  return _border_size;
106 }

◆ configure() [1/2]

void configure ( const ICLTensor input,
ICLTensor output,
const WinogradInfo winograd_info 
)

Set the input and output of the kernel.

Note
Winograd input 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 input 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]inputThe input tensor to transform. Data types supported: F16/F32
[in]outputThe output tensor. The shape for this tensor can be calculated using the utility function compute_winograd_input_transform_shape. Data types supported: Same as input
[in]winograd_infoContains Winograd's information described in WinogradInfo.

Definition at line 108 of file CLWinogradInputTransformKernel.cpp.

References CLKernelLibrary::get().

109 {
110  configure(CLKernelLibrary::get().get_compile_context(), input, output, winograd_info);
111 }
static CLKernelLibrary & get()
Access the KernelLibrary singleton.
void configure(const ICLTensor *input, ICLTensor *output, const WinogradInfo &winograd_info)
Set the input and output of the kernel.

◆ configure() [2/2]

void configure ( const CLCompileContext compile_context,
const ICLTensor input,
ICLTensor output,
const WinogradInfo winograd_info 
)

Set the input and output of the kernel.

Note
Winograd input 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 input 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]inputThe input tensor to transform. Data types supported: F16/F32
[in]outputThe output tensor. The shape for this tensor can be calculated using the utility function compute_winograd_input_transform_shape. Data types supported: Same as input
[in]winograd_infoContains Winograd's information described in WinogradInfo.

Definition at line 113 of file CLWinogradInputTransformKernel.cpp.

References 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(), ICloneable< T >::clone(), arm_compute::compute_winograd_convolution_tiles(), arm_compute::misc::shape_calculator::compute_winograd_input_transform_shape(), WinogradInfo::convolution_info, arm_compute::create_kernel(), ITensorInfo::data_layout(), ITensorInfo::data_type(), ITensorInfo::dimension(), 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, ITensor::info(), arm_compute::test::validation::input, kernel_name, WinogradInfo::kernel_size, arm_compute::lower_string(), arm_compute::NCHW, arm_compute::NHWC, CLBuildOptions::options(), arm_compute::test::validation::output_shape, WinogradInfo::output_tile_size, ITensorInfo::padding(), arm_compute::string_from_data_layout(), 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, and arm_compute::test::validation::winograd_info.

114 {
115  ARM_COMPUTE_ERROR_ON_NULLPTR(input, output);
117 
118  auto padding_info = get_padding_info({ input, output });
119 
120  const PadStrideInfo conv_info = winograd_info.convolution_info;
121  const Size2D output_tile_size = winograd_info.output_tile_size;
122  const Size2D kernel_size = winograd_info.kernel_size;
123 
124  _data_layout = input->info()->data_layout();
125 
126  const size_t idx_w = get_data_layout_dimension_index(_data_layout, DataLayoutDimension::WIDTH);
127  const size_t idx_h = get_data_layout_dimension_index(_data_layout, DataLayoutDimension::HEIGHT);
128 
129  // Compute the number of output tiles along the x and y direction of size "output_tile_size"
130  const Size2D num_tiles = compute_winograd_convolution_tiles(Size2D(input->info()->dimension(idx_w), input->info()->dimension(idx_h)),
131  kernel_size,
132  output_tile_size,
133  conv_info);
134 
135  _input = input;
136  _output = output;
137  _num_tiles_x = num_tiles.width;
138  _num_tiles_y = num_tiles.height;
139 
141 
142  // Output auto initialization if not yet initialized
143  auto_init_if_empty(*output->info(), input->info()->clone()->set_tensor_shape(output_shape));
144 
145  ARM_COMPUTE_ERROR_ON(_num_tiles_x * _num_tiles_y != static_cast<int>(output->info()->dimension(1)));
146  const size_t total_batches = input->info()->tensor_shape().total_size_upper(3);
147 
148  CLBuildOptions build_opts;
149  build_opts.add_option("-DNUM_TILES_X=" + support::cpp11::to_string(_num_tiles_x));
150  build_opts.add_option("-DPAD_LEFT=" + support::cpp11::to_string(conv_info.pad_left()));
151  build_opts.add_option("-DPAD_TOP=" + support::cpp11::to_string(conv_info.pad_top()));
152  build_opts.add_option("-DOUTPUT_TILE_W=" + support::cpp11::to_string(output_tile_size.width));
153  build_opts.add_option("-DOUTPUT_TILE_H=" + support::cpp11::to_string(output_tile_size.height));
154  build_opts.add_option("-DDATA_TYPE=" + get_cl_type_from_data_type(input->info()->data_type()));
155  build_opts.add_option_if(winograd_info.kernel_size.height == 1, "-DWINOGRAD_INPUT_TRANSFORM_HORIZONTAL");
156  build_opts.add_option_if(winograd_info.kernel_size.width == 1, "-DWINOGRAD_INPUT_TRANSFORM_VERTICAL");
157  if(_data_layout == DataLayout::NHWC)
158  {
159  build_opts.add_option_if(total_batches > 1, "-DNUM_TILES_Y=" + support::cpp11::to_string(_num_tiles_y));
160  build_opts.add_option("-DSRC_DIM_1=" + support::cpp11::to_string(_input->info()->dimension(1)));
161  build_opts.add_option("-DSRC_DIM_2=" + support::cpp11::to_string(_input->info()->dimension(2)));
162  }
163  else
164  {
165  build_opts.add_option_if(total_batches > 1, "-DSRC_DEPTH=" + support::cpp11::to_string(_input->info()->dimension(2)));
166  }
167 
168  // Create kernel
169  std::string kernel_name = "winograd_input_transform_" + output_tile_size.to_string() + "_" + kernel_size.to_string();
170 
171  // Get the maximum dimension from the tile size
172  const unsigned int tile_max_dim = std::max(output_tile_size.width, output_tile_size.height);
173 
174  // Check optimized kernel if output_dims == 2x2
175  if((tile_max_dim == 2) && (_data_layout == DataLayout::NCHW))
176  {
177  _step_z = (_input->info()->dimension(2) % 2) != 0 ? 1 : 2;
178  }
179 
180  // Append stepz and data layout
181  kernel_name += "_stepz";
182  kernel_name += support::cpp11::to_string(_step_z);
183  kernel_name += "_" + lower_string(string_from_data_layout(_data_layout));
184 
185  _kernel = create_kernel(compile_context, kernel_name, build_opts.options());
186 
187  // Create window and update padding
188  auto win_config = validate_and_configure_window(input->info(), output->info(), winograd_info);
189  ARM_COMPUTE_ERROR_THROW_ON(win_config.first);
190  ICLKernel::configure_internal(win_config.second, cl::NDRange(1, 1, 8));
191 
192  _border_size = BorderSize(_input->info()->padding());
193 
194  ARM_COMPUTE_ERROR_ON((input->info()->data_layout() == DataLayout::NHWC) && has_padding_changed(padding_info));
195 
196  _config_id = kernel_name;
197  _config_id += support::cpp11::to_string(input->info()->dimension(0));
198  _config_id += "_";
199  _config_id += support::cpp11::to_string(input->info()->dimension(1));
200  _config_id += "_";
201  _config_id += support::cpp11::to_string(input->info()->dimension(2));
202  _config_id += "_";
203  _config_id += support::cpp11::to_string(conv_info.pad_left());
204  _config_id += "_";
205  _config_id += support::cpp11::to_string(conv_info.pad_top());
206  _config_id += "_";
207  _config_id += lower_string(string_from_data_layout(_data_layout));
208 }
Shape of a tensor.
Definition: TensorShape.h:39
TensorShape compute_winograd_input_transform_shape(const ITensorInfo &input, const WinogradInfo &winograd_info)
Calculate the winograd input transform shape.
virtual size_t dimension(size_t index) const =0
Return the size of the requested dimension.
Container for 2D border size.
Definition: Types.h:273
const StringSet & options() const
Gets the current options list set.
PadStrideInfo convolution_info
Convolution info (Pads, strides,...)
Definition: Types.h:2200
std::string to_string(T &&value)
Convert integer and float values to string.
virtual DataType data_type() const =0
Data type used for each element of the tensor.
#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
size_t total_size_upper(size_t dimension) const
Collapses given dimension and above.
Definition: TensorShape.h:182
#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
size_t height
Height of the image region or rectangle.
Definition: Size2D.h:90
void add_option(std::string option)
Adds option to the existing build option list.
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
virtual const TensorShape & tensor_shape() const =0
Size for each dimension of the tensor.
Size2D output_tile_size
Width and height of the output tile.
Definition: Types.h:2197
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 std::unique_ptr< T > clone() const =0
Provide a clone of the current object of class T.
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor&#39;s metadata.
void add_option_if(bool cond, std::string option)
Adds option if a given condition is true;.
Padding and stride information class.
Definition: Types.h:722
virtual PaddingSize padding() const =0
Padding of tensor.
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
Num samples, channels, height, width.
const std::string & string_from_data_layout(DataLayout dl)
Convert a data layout identity into a string.
Definition: Utils.cpp:123
size_t width
Width of the image region or rectangle.
Definition: Size2D.h:89
Class for specifying the size of an image or rectangle.
Definition: Size2D.h:34
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)
Size2D kernel_size
Width and height of the kernel.
Definition: Types.h:2198
#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
virtual DataLayout data_layout() const =0
Get the data layout of the tensor.
std::string to_string() const
Definition: Size2D.cpp:29

◆ 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 219 of file CLWinogradInputTransformKernel.cpp.

References ICLKernel::add_3D_tensor_argument(), ARM_COMPUTE_ERROR_ON, ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW, ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL, arm_compute::CHANNEL, Window::collapse_if_possible(), Window::DimZ, arm_compute::mlgo::parser::end(), arm_compute::enqueue(), Window::first_slice_window_3D(), arm_compute::get_data_layout_dimension_index(), arm_compute::HEIGHT, ITensor::info(), ICLKernel::lws_hint(), arm_compute::NHWC, ICLKernel::num_arguments_per_3D_tensor(), Window::set(), Window::shape(), arm_compute::test::validation::reference::slice(), Window::slide_window_slice_3D(), enable_tracing::start, ITensorInfo::strides_in_bytes(), TensorShape::total_size_upper(), arm_compute::WIDTH, and IKernel::window().

220 {
223 
224  const size_t idx_w = get_data_layout_dimension_index(_data_layout, DataLayoutDimension::WIDTH);
225  const size_t idx_h = get_data_layout_dimension_index(_data_layout, DataLayoutDimension::HEIGHT);
226  const size_t idx_c = get_data_layout_dimension_index(_data_layout, DataLayoutDimension::CHANNEL);
227  const size_t total_batches = window.shape().total_size_upper(3);
228 
229  // Collapse window
230  Window window_collapsed = window.collapse_if_possible(ICLKernel::window(), Window::DimZ);
231 
232  Window slice = window_collapsed.first_slice_window_3D();
233  slice.set(idx_w, Window::Dimension(0, _num_tiles_x, 1));
234  slice.set(idx_h, Window::Dimension(0, _num_tiles_y, 1));
235  if(_data_layout == DataLayout::NHWC)
236  {
237  slice.set(idx_h, Window::Dimension(0, _num_tiles_y * total_batches, 1));
238  }
239 
240  ARM_COMPUTE_ERROR_ON(((slice[idx_c].end() - slice[idx_c].start()) % _step_z) != 0);
241  slice.set(idx_c, Window::Dimension(slice[idx_c].start(), slice[idx_c].end(), _step_z));
242 
243  unsigned int idx = 2 * num_arguments_per_3D_tensor();
244  _kernel.setArg<cl_uint>(idx++, static_cast<unsigned int>(_input->info()->strides_in_bytes()[3]));
245  _kernel.setArg<cl_uint>(idx++, static_cast<unsigned int>(_output->info()->strides_in_bytes()[3]));
246 
247  do
248  {
249  unsigned int idx = 0;
250  add_3D_tensor_argument(idx, _input, slice);
251  add_3D_tensor_argument(idx, _output, slice);
252 
253  enqueue(queue, *this, slice, lws_hint());
254  }
255  while(window_collapsed.slide_window_slice_3D(slice));
256 }
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
#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
size_t total_size_upper(size_t dimension) const
Collapses given dimension and above.
Definition: TensorShape.h:182
Describe one of the image&#39;s dimensions with a start, end and step.
Definition: Window.h:77
void add_3D_tensor_argument(unsigned int &idx, const ICLTensor *tensor, const Window &window)
Add the passed 3D tensor&#39;s parameters to the object&#39;s kernel&#39;s arguments starting from the index idx...
Definition: ICLKernel.h:172
static constexpr unsigned int num_arguments_per_3D_tensor()
Returns the number of arguments enqueued per 3D tensor object.
Definition: ICLKernel.h:214
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 ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor&#39;s metadata.
void end(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:290
void set(size_t dimension, const Dimension &dim)
Set the values of a given dimension.
Definition: Window.inl:49
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 DimZ
Alias for dimension 2 also known as Z dimension.
Definition: Window.h:47
Num samples, height, width, channels.
TensorShape shape() const
Return the shape of the window in number of steps.
Definition: Window.inl:284
virtual const Strides & strides_in_bytes() const =0
The strides in bytes for accessing each dimension of the tensor.
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
Window first_slice_window_3D() const
First 3D slice of the window.
Definition: Window.h:291
Describe a multidimensional execution window.
Definition: Window.h:39
#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 output,
const WinogradInfo winograd_info 
)
static

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

Note
Winograd input 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 input 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]inputThe input tensor to transform. Data types supported: F16/F32
[in]outputThe output tensor. The shape for this tensor can be calculated using the utility function compute_winograd_input_transform_shape. Data types supported: Same as input
[in]winograd_infoContains Winograd's information described in WinogradInfo.
Returns
a status

Definition at line 210 of file CLWinogradInputTransformKernel.cpp.

References ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR, ARM_COMPUTE_RETURN_ON_ERROR, ICloneable< T >::clone(), arm_compute::validate_arguments(), and arm_compute::test::validation::winograd_info.

Referenced by CLWinogradInputTransform::validate().

211 {
213  ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(input, output, winograd_info));
214  ARM_COMPUTE_RETURN_ON_ERROR(validate_and_configure_window(input->clone().get(), output->clone().get(), winograd_info).first);
215 
216  return Status{};
217 }
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Definition: Error.h:204
Status class.
Definition: Error.h:52
#define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...)
Definition: Validate.h:163
virtual std::unique_ptr< T > clone() const =0
Provide a clone of the current object of class T.
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: