24.02.1
|
Go to the documentation of this file.
77 static_cast<int32_t
>(
src.num_dimensions()) <=
info.axis);
100 const auto element_size =
src.element_size();
103 const auto src_qinfo =
src.quantization_info().uniform();
104 const auto dst_qinfo =
dst.quantization_info().uniform();
112 const auto vec_size_leftover =
dst_shape[0] % vec_size;
148 tmp_shape.
set(0, length * vec_size,
false);
149 tmp_shape.
set(1,
dst_shape[0] + (vec_size - vec_size_leftover) % vec_size,
false);
151 for (
size_t i = 2; i <= static_cast<size_t>(axis); ++i)
161 _tmp_info =
TensorInfo(tmp_shape, 1, tmp_data_type);
169 bool has_collapsed =
true;
175 ICLKernel::configure_internal(win);
201 const auto *dst_info =
dst->info();
203 auto dst_strides = dst_info->strides_in_bytes();
205 const auto src_stride_axis = src_strides[_axis];
206 const auto dst_stride_axis = dst_strides[_axis];
211 src_strides.
remove(_axis);
212 dst_strides.remove(_axis);
215 _kernel.setArg<cl_uint>(1, src_strides[0]);
216 _kernel.setArg<cl_uint>(2, src_strides[1]);
217 _kernel.setArg<cl_uint>(3, src_strides[2]);
221 _kernel.setArg<cl_uint>(6, dst_strides[0]);
222 _kernel.setArg<cl_uint>(7, dst_strides[1]);
223 _kernel.setArg<cl_uint>(8, dst_strides[2]);
224 _kernel.setArg<cl_uint>(9, dst_info->offset_first_element_in_bytes());
228 const auto *tmp_info = tmp->
info();
232 _kernel.setArg<cl_uint>(11, tmp_strides[1]);
233 _kernel.setArg<cl_uint>(12, tmp_strides[2]);
234 _kernel.setArg<cl_uint>(13, tmp_strides[3]);
235 _kernel.setArg<cl_uint>(14, 0);
240 _kernel.setArg<cl_uint>(15, src_stride_axis);
241 _kernel.setArg<cl_uint>(16, dst_stride_axis);
245 _kernel.setArg(0,
src->cl_buffer());
246 _kernel.setArg(5,
dst->cl_buffer());
Class to describe a number of elements in each dimension.
std::string to_string(T &&value)
Convert integer and float values to string.
Descriptor used by the softmax kernels.
SimpleTensor< float > src
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.
void remove(size_t idx)
Remove dimension of a given index.
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)
@ QASYMM8
quantized, asymmetric fixed-point 8-bit number unsigned
std::string lower_string(const std::string &val)
Lower a given string.
#define ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(k)
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_SHAPES(...)
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.
Interface for OpenCL tensor.
virtual const cl::Buffer & cl_buffer() const =0
Interface to be implemented by the child class to return a reference to the OpenCL buffer containing ...
Window shift_dimensions(unsigned int shift_value, unsigned int start_dim=0) const
Shift down all the dimensions of a window starting from the specified dimension.
const Strides & strides_in_bytes() const override
The strides in bytes for accessing each dimension of the tensor.
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.
T wrap_around(T x, T m)
Wrap-around a number within the range 0 <= x < m.
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(...)
static Status validate(const ITensorInfo &src, const ITensorInfo &dst, const SoftmaxKernelInfo &info)
Check if the kernel arguments are valid.
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.
QuantizationInfo get_softmax_output_quantization_info(DataType input_type, bool is_log)
Returns output quantization information for softmax layer.
const ITensor * get_const_tensor(int id) const
Get constant tensor of a given id.
#define ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_NOT_IN(t,...)
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.
size_t total_size() const override
Returns the total size of the tensor in bytes.
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
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::string float_to_string_with_full_precision(float val)
Create a string with the float in full precision.
const TensorInfo & tmp_tensor_info() const
Get the tensor info of the temporary tensor.
Wrapper to configure the Khronos OpenCL C++ header.
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
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.
Store the tensor's metadata.
Describe a multidimensional execution window.
Copyright (c) 2017-2024 Arm Limited.
std::string to_string(const ClComponentElementwiseBinary::Attributes::ElementwiseOp &op)
Formatted output of the arm_compute::experimental::dynamic_fusion::ClComponentElementwiseBinary::Attr...
@ F16
16-bit floating-point number
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,...
virtual const Strides & strides_in_bytes() const =0
The strides in bytes for accessing each dimension of the tensor.
cl::NDRange lws_hint() const
Return the Local-Workgroup-Size hint.
TensorInfo src_info(src_shape, 1, data_type)
bool is_data_type_quantized_asymmetric(DataType dt)
Check if a given data type is of asymmetric quantized type.
Store the tensor's metadata.
@ F32
32-bit floating-point number
size_t offset_first_element_in_bytes() const override
The offset from the beginning of the memory allocation to the first element of the tensor.
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
void configure(const CLCompileContext &compile_context, const ITensorInfo &src, ITensorInfo &dst, const SoftmaxKernelInfo &info)
Configure the kernel.
TensorShape & set(size_t dimension, size_t value, bool apply_dim_correction=true, bool increase_dim_unit=true)
Accessor to set the value of one of the dimensions.
unsigned int num_dimensions() const
Returns the effective dimensionality of the tensor.
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.