24.02.1
|
Go to the documentation of this file.
45 const ITensorInfo *src1,
46 const ITensorInfo *src2,
47 const ITensorInfo *
dst,
48 const Conv3dInfo &conv3d_info)
63 "Weights feature map dimension should match the respective src's one");
67 (src0->dimension(1) + conv3d_info.padding.left + conv3d_info.padding.right));
69 (src0->dimension(2) + conv3d_info.padding.top + conv3d_info.padding.bottom));
71 (src0->dimension(3) + conv3d_info.padding.front + conv3d_info.padding.back));
84 "Biases size and number of dst feature maps should match");
89 if (
dst->total_size() != 0)
121 const size_t src_width = src0->
dimension(1);
122 const size_t src_height = src0->
dimension(2);
123 const size_t src_depth = src0->
dimension(3);
124 const size_t src_channels = src0->
dimension(0);
125 const size_t dst_width =
dst->dimension(1);
126 const size_t dst_height =
dst->dimension(2);
127 const size_t dst_depth =
dst->dimension(3);
128 const size_t dst_channels =
dst->dimension(0);
129 const size_t weights_width = src1->
dimension(2);
130 const size_t weights_height = src1->
dimension(3);
131 const size_t weights_depth = src1->
dimension(4);
133 const size_t pad_top = conv3d_info.
padding.
top;
135 const size_t conv_stride_x = conv3d_info.
stride.
x();
136 const size_t conv_stride_y = conv3d_info.
stride.
y();
137 const size_t conv_stride_z = conv3d_info.
stride.
z();
139 const size_t n0 = std::min(
dst->dimension(0),
static_cast<size_t>(4u));
142 const size_t partial_store_n0 =
dst->dimension(0) % n0;
183 zero_value.
get(zero_value_s32);
186 int output_multiplier = 0;
187 int output_shift = 0;
207 std::string
kernel_name =
"direct_convolution3d_ndhwc";
212 ICLKernel::configure_internal(win);
265 dst->info()->dimension(3),
270 unsigned int idx = 0;
274 if (biases !=
nullptr)
Class to describe a number of elements in each dimension.
std::string to_string(T &&value)
Convert integer and float values to string.
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.
SimpleTensor< float > src
Class describing the value of a pixel for any image format.
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.
Window calculate_max_window(const ValidRegion &valid_region, const Steps &steps, bool skip_border, BorderSize border_size)
void configure(const CLCompileContext &compile_context, const ITensorInfo *src0, const ITensorInfo *src1, const ITensorInfo *src2, ITensorInfo *dst, const Conv3dInfo &conv3d_info)
Set the src, weights, biases and dst tensors info.
@ QASYMM8
quantized, asymmetric fixed-point 8-bit number unsigned
void get(uint8_t &v) const
Interpret the pixel value as a U8.
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)
size_t x() const
Semantic accessor for width as x.
ITensor * get_tensor(int id)
Get tensor of a given id from the pac.
const std::string & string_from_data_type(DataType dt)
Convert a data type identity into a string.
ClDirectConv3dKernel()
Construtor.
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(...)
#define ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c,...)
#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.
@ DIRECT
Direct Convolution CL kernel type.
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
size_t y() const
Semantic accessor for height as y.
const ITensor * get_const_tensor(int id) const
Get constant tensor of a given id.
#define ARM_COMPUTE_ERROR_THROW_ON(status)
size_t top
Padding across the height dimenstion on the top, in elements.
#define ARM_COMPUTE_RETURN_ERROR_ON(cond)
If the condition is true, an error is returned.
#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.
@ QASYMM8_SIGNED
quantized, asymmetric fixed-point 8-bit number signed
#define ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(f, s)
virtual DataType data_type() const =0
Data type used for each element of the tensor.
size_t front
Padding across the depth dimenstion on the front, in elements.
UniformQuantizationInfo uniform() const
Return per layer quantization info.
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.
Describe one of the image's dimensions with a start, end and step.
size_t z() const
Semantic accessor for depth as z.
static constexpr size_t DimY
Alias for dimension 1 also known as Y dimension.
virtual QuantizationInfo quantization_info() const =0
Get the quantization settings (scale and offset) of the tensor.
auto ceil_to_multiple(S value, T divisor) -> decltype(((value+divisor - 1)/divisor) *divisor)
Computes the smallest number larger or equal to value that is a multiple of divisor.
Window first_slice_window_3D() const
First 3D slice of the window.
#define ARM_COMPUTE_ERROR_ON_MISMATCHING_DATA_LAYOUT(...)
const Window & window() const
The maximum window the kernel can be executed on.
std::string get_cl_type_from_data_type(const DataType &dt)
Translates a tensor data type to the appropriate OpenCL type.
size_t left
Padding across the width dimenstion on the left, in elements.
TensorShape compute_conv3d_shape(const TensorShape &src, const TensorShape &weights, const Conv3dInfo &conv3d_info)
Calculate the output shape of 3d Convolution.
Describe a multidimensional execution window.
static Status validate(const ITensorInfo *src0, const ITensorInfo *src1, const ITensorInfo *src2, const ITensorInfo *dst, const Conv3dInfo &conv3d_info)
Static function to check if given info will lead to a valid configuration.
#define ARM_COMPUTE_RETURN_ERROR_ON_MSG(cond, msg)
If the condition is true, an error is returned.
Copyright (c) 2017-2024 Arm Limited.
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DIMENSIONS(...)
@ F16
16-bit floating-point number
Descriptor used by the 3d Convolution function.
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,...
static constexpr size_t DimZ
Alias for dimension 2 also known as Z dimension.
@ S32
signed 32-bit number
cl::NDRange lws_hint() const
Return the Local-Workgroup-Size hint.
Status calculate_quantized_multiplier(float multiplier, int32_t *quant_multiplier, int32_t *shift, bool ignore_epsilon=false)
Calculate quantized representation of multiplier.
bool is_data_type_quantized(DataType dt)
Check if a given data type is of quantized type.
Store the tensor's metadata.
@ F32
32-bit floating-point number
DataType
Available data types.
SimpleTensor< T > slice(const SimpleTensor< T > &src, Coordinates starts, Coordinates ends)
@ NDHWC
Num samples, depth, height, width, channels.
std::set< std::string > build_options
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.