24.02.1
|
Go to the documentation of this file.
37 using namespace misc::shape_calculator;
45 const ITensorInfo *biases,
46 const ITensorInfo *output,
56 if (biases !=
nullptr)
63 (biases->dimension(0) !=
input->tensor_shape()[3]));
65 (
input->num_dimensions() == 5) &&
66 (biases->dimension(0) !=
input->tensor_shape()[3] || biases->dimension(1) !=
input->tensor_shape()[4]));
70 if (output->total_size() != 0)
116 ICLKernel::configure_internal(win);
148 unsigned int idx = num_arguments_per_3D_tensor() + num_arguments_per_2D_tensor();
149 idx += (biases !=
nullptr) ? num_arguments_per_1D_tensor() : 0;
150 _kernel.setArg<cl_uint>(idx++,
src->info()->dimension(0));
151 _kernel.setArg<cl_uint>(idx++,
src->info()->dimension(1));
152 _kernel.setArg<cl_uint>(idx++,
src->info()->dimension(2));
153 _kernel.setArg<cl_uint>(idx++,
src->info()->dimension(3));
154 _kernel.setArg<cl_uint>(idx++,
dst->info()->strides_in_bytes().z());
156 if (biases !=
nullptr)
166 add_3D_tensor_argument(idx,
src, in_slice);
167 add_2D_tensor_argument(idx,
dst, out_slice);
168 if (biases !=
nullptr)
170 add_1D_tensor_argument(idx, biases, biases_slice);
175 enqueue(queue, *
this, in_slice, lws_hint());
Class to describe a number of elements in each dimension.
std::string to_string(T &&value)
Convert integer and float values to string.
SimpleTensor< float > src
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)
@ NHWC
Num samples, height, width, channels.
void run_op(ITensorPack &tensors, const Window &window, cl::CommandQueue &queue) override
Enqueue the OpenCL kernel to process the given window on the passed OpenCL command queue.
Status validate_arguments(const ITensorInfo *src, const ITensorInfo *weights, const ITensorInfo *dst, const PadStrideInfo &conv_info)
#define ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(k)
void use_tensor_dimensions(const TensorShape &shape, size_t first_dimension=Window::DimX)
Use the tensor's dimensions to fill the window dimensions.
ITensor * get_tensor(int id)
Get tensor of a given id from the pac.
bool slide_window_slice_2D(Window &slice) const
Slide the passed 2D window slice.
Window first_slice_window_1D() const
First 1D slice of the window.
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(...)
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
size_t data_size_from_type(DataType data_type)
The size in bytes of the data type.
const ITensor * get_const_tensor(int id) const
Get constant tensor of a given id.
#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...
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_UNUSED(...)
To avoid unused variables warnings.
Window first_slice_window_3D() const
First 3D slice of the window.
const Window & window() const
The maximum window the kernel can be executed on.
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_QUANTIZATION_INFO(...)
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.
TensorShape compute_weights_reshaped_shape(const ITensorInfo &weights, bool has_bias=false, unsigned int num_groups=1)
Calculate the reshaped shape of the weights.
Describe a multidimensional execution window.
@ ELEMENTWISE
Elementwise CL kernel type.
Copyright (c) 2017-2024 Arm Limited.
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DIMENSIONS(...)
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.
bool is_data_type_float(DataType dt)
Check if a given data type is of floating point type.
static Status validate(const ITensorInfo *src, const ITensorInfo *biases, const ITensorInfo *dst, unsigned int num_groups=1)
Static function to check if given info will lead to a valid configuration.
#define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...)
Store the tensor's metadata.
bool slide_window_slice_1D(Window &slice) const
Slide the passed 1D window slice.
@ UNKNOWN
Unknown data type.
#define ARM_COMPUTE_ERROR_ON_MISMATCHING_WINDOWS(f, w)
bool slide_window_slice_4D(Window &slice) const
Slide the passed 4D window slice.
DataType
Available data types.
std::unordered_map< const ITensorInfo *, PaddingSize > get_padding_info(std::initializer_list< const ITensorInfo * > infos)
Stores padding information before configuring a kernel.
void configure(const ClCompileContext &compile_context, const ITensorInfo *src, const ITensorInfo *biases, ITensorInfo *dst, unsigned int num_groups=1)
Set the input and output of the kernel.
Window first_slice_window_2D() const
First 2D slice of the window.
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.