52 Status validate_arguments(
const ITensorInfo *
input,
const ITensorInfo *output,
const WinogradInfo &winograd_info)
57 const Size2D kernel_size = winograd_info.kernel_size;
58 const Size2D output_tile_size = winograd_info.output_tile_size;
68 if(output->total_size() != 0)
79 std::pair<Status, Window> validate_and_configure_window(ITensorInfo *input, ITensorInfo *output)
84 const unsigned int num_elems_processed_per_iteration_x = input->data_layout() ==
DataLayout::NCHW ? input->dimension(0) : 1;
85 const unsigned int num_elems_processed_per_iteration_y = input->dimension(1);
86 const unsigned int num_elems_read_per_iteration_z = input->data_layout() ==
DataLayout::NCHW ? 1 : input->dimension(2);
88 Window win =
calculate_max_window(*input, Steps(num_elems_processed_per_iteration_x, num_elems_processed_per_iteration_y, num_elems_read_per_iteration_z));
90 return std::make_pair(Status{}, win_collapsed);
113 build_opts.add_option_if(winograd_info.
kernel_size.
height == 1,
"-DWINOGRAD_FILTER_TRANSFORM_HORIZONTAL");
114 build_opts.add_option_if(winograd_info.
kernel_size.
width == 1,
"-DWINOGRAD_FILTER_TRANSFORM_VERTICAL");
120 _kernel =
create_kernel(compile_context, kernel_name, build_opts.options());
123 auto win_config = validate_and_configure_window(src, dst);
125 IClKernel::configure_internal(win_config.second);
149 unsigned int idx = 0;
150 add_4D_tensor_argument(idx,
src, window);
151 add_3D_tensor_argument(idx, dst, window_out);
152 enqueue(queue, *
this, window, lws_hint());
Window calculate_max_window(const ValidRegion &valid_region, const Steps &steps, bool skip_border, BorderSize border_size)
#define ARM_COMPUTE_RETURN_ERROR_ON_F16_UNSUPPORTED(tensor)
virtual size_t dimension(size_t index) const =0
Return the size of the requested dimension.
void enqueue(cl::CommandQueue &queue, ICLKernel &kernel, const Window &window, const cl::NDRange &lws_hint=CLKernelLibrary::get().default_ndrange(), bool use_dummy_work_items=false)
Add the kernel to the command queue with the given window.
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
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.
1 channel, 1 F32 per channel
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Store the tensor's metadata.
#define ARM_COMPUTE_ERROR_THROW_ON(status)
Manages all the OpenCL kernels compilation and caching, provides accessors for the OpenCL Context...
std::string lower_string(const std::string &val)
Lower a given string.
#define ARM_COMPUTE_RETURN_ERROR_ON(cond)
If the condition is true, an error is returned.
void use_tensor_dimensions(const TensorShape &shape, size_t first_dimension=Window::DimX)
Use the tensor's dimensions to fill the window dimensions.
SimpleTensor< float > src
Copyright (c) 2017-2021 Arm Limited.
size_t height
Height of the image region or rectangle.
1 channel, 1 F16 per channel
void add_option(std::string option)
Adds option to the existing build option list.
const ITensor * get_const_tensor(int id) const
Get constant tensor of a given id.
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.
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Size2D output_tile_size
Width and height of the output tile.
std::string get_cl_type_from_data_type(const DataType &dt)
Translates a tensor data type to the appropriate OpenCL type.
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.
TensorShape compute_winograd_filter_transform_shape(const ITensorInfo &input, const WinogradInfo &winograd_info)
Calculate the winograd filter transform shape.
#define ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(k)
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.
Num samples, channels, height, width.
Convolution using Winograd.
ITensor * get_tensor(int id)
Get tensor of a given id from the pac.
const std::string & string_from_data_layout(DataLayout dl)
Convert a data layout identity into a string.
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_SHAPES(...)
size_t width
Width of the image region or rectangle.
static constexpr size_t DimZ
Alias for dimension 2 also known as Z dimension.
Class for specifying the size of an image or rectangle.
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(...)
#define ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c,...)
std::unordered_map< const ITensorInfo *, PaddingSize > get_padding_info(std::initializer_list< const ITensorInfo *> infos)
Stores padding information before configuring a kernel.
#define ARM_COMPUTE_RETURN_ERROR_ON_MSG(cond, msg)
If the condition is true, an error is returned.
Size2D kernel_size
Width and height of the kernel.
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
size_t get_data_layout_dimension_index(const DataLayout data_layout, const DataLayoutDimension data_layout_dimension)
Get the index of the given dimension.
bool cl_winograd_convolution_layer_supported(const Size2D &output_tile, const Size2D &kernel_size, DataLayout data_layout)
This function checks if the Winograd configuration (defined through the output tile, kernel size and the data layout) is supported on OpenCL.
Describe a multidimensional execution window.
#define ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(f, s)
virtual DataLayout data_layout() const =0
Get the data layout of the tensor.
std::string to_string() const