24.02.1
|
Go to the documentation of this file.
50 const unsigned int channels =
55 "Channel shuffling with same number of groups as number of channels would be inefficient");
59 "The number of channels must be a multiple of the number of groups");
62 if (output->total_size() != 0)
80 unsigned int num_elems_processed_per_iteration_x =
84 return std::make_pair(Status{}, win_collapsed);
88 const unsigned int num_elems_processed_per_iteration_x = max_cl_vector_width /
input->element_size();
89 constexpr
unsigned int num_elems_processed_per_iteration_y = 2;
93 *
input, Steps(num_elems_processed_per_iteration_x, num_elems_processed_per_iteration_y));
94 AccessWindowRectangle input_access(
input, 0, 0, num_elems_processed_per_iteration_x,
95 num_elems_processed_per_iteration_y);
96 AccessWindowRectangle output_access(output, 0, 0, num_elems_processed_per_iteration_x,
97 num_elems_processed_per_iteration_y);
105 return std::make_pair(err, win_collapsed);
134 const unsigned int channels =
136 unsigned int vec_size_x = 0;
137 unsigned int vec_size_x_leftovers = 0;
141 vec_size_x_leftovers =
input->info()->dimension(0) % vec_size_x;
145 vec_size_x = max_cl_vector_width /
input->info()->element_size();
166 ICLKernel::configure_internal(win_config.second);
206 unsigned int idx = 0;
std::string to_string(T &&value)
Convert integer and float values to string.
static Status validate(const ITensorInfo *input, const ITensorInfo *output, unsigned int num_groups)
Static function to check if given info will lead to a valid configuration of CLChannelShuffleLayerKer...
DataLayout
[DataLayout enum definition]
const StringSet & options() const
Gets the current options list set.
Window calculate_max_window(const ValidRegion &valid_region, const Steps &steps, bool skip_border, BorderSize border_size)
void run(const Window &window, cl::CommandQueue &queue) override
Enqueue the OpenCL kernel to process the given window on the passed OpenCL command queue.
@ NHWC
Num samples, height, width, channels.
std::string lower_string(const std::string &val)
Lower a given string.
Status validate_arguments(const ITensorInfo *src, const ITensorInfo *weights, const ITensorInfo *dst, const PadStrideInfo &conv_info)
#define ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(k)
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_SHAPES(...)
Interface for OpenCL tensor.
bool update_window_and_padding(Window &win, Ts &&...patterns)
Update window and padding size for each of the access patterns.
void configure(const ICLTensor *input, ICLTensor *output, unsigned int num_groups)
Configure function's inputs and outputs.
const std::string & string_from_data_type(DataType dt)
Convert a data type identity into a string.
static CLKernelLibrary & get()
Access the KernelLibrary singleton.
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(...)
Manages all the OpenCL kernels compilation and caching, provides accessors for the OpenCL Context.
constexpr auto data_layout
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
virtual size_t dimension(size_t index) const =0
Return the size of the requested dimension.
@ RUNTIME_ERROR
Generic runtime error.
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
#define ARM_COMPUTE_ERROR_THROW_ON(status)
void add_option(std::string option)
Adds option to the existing build option list.
#define ARM_COMPUTE_RETURN_ERROR_ON(cond)
If the condition is true, an error is returned.
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...
#define ARM_COMPUTE_RETURN_ERROR_ON_F16_UNSUPPORTED(tensor)
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.
void add_option_if(bool cond, std::string option)
Adds option if a given condition is true;.
#define ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(f, s)
std::pair< Status, Window > validate_and_configure_window(ITensorInfo *src, ITensorInfo *dst)
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.
const Window & window() const
The maximum window the kernel can be executed on.
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_QUANTIZATION_INFO(...)
const std::string & string_from_data_layout(DataLayout dl)
Convert a data layout identity into a string.
virtual std::unique_ptr< T > clone() const =0
Provide a clone of the current object of class T.
size_t get_data_layout_dimension_index(const DataLayout &data_layout, const DataLayoutDimension &data_layout_dimension)
Get the index of the given dimension.
const unsigned int num_groups
std::string get_cl_unsigned_type_from_element_size(size_t element_size)
Translates the element size to an unsigned integer data type.
Describe a multidimensional execution window.
@ ELEMENTWISE
Elementwise CL kernel type.
#define ARM_COMPUTE_RETURN_ERROR_ON_MSG(cond, msg)
If the condition is true, an error is returned.
Copyright (c) 2017-2024 Arm Limited.
unsigned int adjust_vec_size(unsigned int vec_size, size_t dim0)
Returns the adjusted vector size in case it is less than the input's first dimension,...
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.
static constexpr size_t DimZ
Alias for dimension 2 also known as Z dimension.
cl::NDRange lws_hint() const
Return the Local-Workgroup-Size hint.
Store the tensor's metadata.
CLChannelShuffleLayerKernel()
Default constructor.
#define ARM_COMPUTE_CREATE_ERROR(error_code, msg)
Creates an error with a given message.
@ UNKNOWN
Unknown data type.
std::unordered_map< const ITensorInfo *, PaddingSize > get_padding_info(std::initializer_list< const ITensorInfo * > infos)
Stores padding information before configuring a kernel.
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.