Compute Library
 22.11
CLArgMinMaxLayerKernel Class Reference

Interface for the reduction operation kernel. More...

#include <CLArgMinMaxLayerKernel.h>

Collaboration diagram for CLArgMinMaxLayerKernel:
[legend]

Public Member Functions

 CLArgMinMaxLayerKernel ()
 Default constructor. More...
 
 CLArgMinMaxLayerKernel (const CLArgMinMaxLayerKernel &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
CLArgMinMaxLayerKerneloperator= (const CLArgMinMaxLayerKernel &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 CLArgMinMaxLayerKernel (CLArgMinMaxLayerKernel &&)=default
 Allow instances of this class to be moved. More...
 
CLArgMinMaxLayerKerneloperator= (CLArgMinMaxLayerKernel &&)=default
 Allow instances of this class to be moved. More...
 
 ~CLArgMinMaxLayerKernel ()=default
 Default destructor. More...
 
void configure (const ICLTensor *input, const ICLTensor *prev_output, ICLTensor *output, unsigned int axis, ReductionOperation op)
 Set the input and output tensors. More...
 
void configure (const CLCompileContext &compile_context, const ICLTensor *input, const ICLTensor *prev_output, ICLTensor *output, unsigned int axis, ReductionOperation op)
 Set the input and output tensors. More...
 
void run (const Window &window, cl::CommandQueue &queue) override
 Enqueue the OpenCL kernel to process the given window on the passed OpenCL command queue. More...
 
- Public Member Functions inherited from ICLKernel
 ICLKernel ()
 Constructor. More...
 
cl::Kernel & kernel ()
 Returns a reference to the OpenCL kernel of this object. More...
 
CLKernelType type () const
 Returns the CL kernel type. More...
 
template<typename T >
void add_1D_array_argument (unsigned int &idx, const ICLArray< T > *array, const Strides &strides, unsigned int num_dimensions, const Window &window)
 Add the passed 1D array's parameters to the object's kernel's arguments starting from the index idx. More...
 
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. More...
 
void add_1D_tensor_argument_if (bool cond, 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 if the condition is true. More...
 
void add_2D_tensor_argument (unsigned int &idx, const ICLTensor *tensor, const Window &window)
 Add the passed 2D tensor's parameters to the object's kernel's arguments starting from the index idx. More...
 
void add_2D_tensor_argument_if (bool cond, unsigned int &idx, const ICLTensor *tensor, const Window &window)
 Add the passed 2D tensor's parameters to the object's kernel's arguments starting from the index idx if the condition is true. More...
 
void add_3D_tensor_argument (unsigned int &idx, const ICLTensor *tensor, const Window &window)
 Add the passed 3D tensor's parameters to the object's kernel's arguments starting from the index idx. More...
 
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. More...
 
void add_5D_tensor_argument (unsigned int &idx, const ICLTensor *tensor, const Window &window)
 Add the passed 5D tensor's parameters to the object's kernel's arguments starting from the index idx. More...
 
void add_3d_tensor_nhw_argument (unsigned int &idx, const ICLTensor *tensor)
 Add the passed NHW 3D tensor's parameters to the object's kernel's arguments by passing strides, dimensions and the offset to the first valid element in bytes. More...
 
void add_4d_tensor_nhwc_argument (unsigned int &idx, const ICLTensor *tensor)
 Add the passed NHWC 4D tensor's parameters to the object's kernel's arguments by passing strides, dimensions and the offset to the first valid element in bytes. More...
 
virtual void run_op (ITensorPack &tensors, const Window &window, cl::CommandQueue &queue)
 Enqueue the OpenCL kernel to process the given window on the passed OpenCL command queue. More...
 
virtual void run_composite_op (ITensorPack &tensors, const Window &window, cl::CommandQueue &queue, const experimental::dynamic_fusion::ClExecutionDescriptor &exec_desc)
 The execution is carried out through run_op method. But the run_op method needs to be extended to include ClExecutionDescriptor as now LWS GWS tuning will be separated from the IKernel. More...
 
template<typename T >
void add_argument (unsigned int &idx, T value)
 Add the passed parameters to the object's kernel's arguments starting from the index idx. More...
 
void set_lws_hint (const cl::NDRange &lws_hint)
 Set the Local-Workgroup-Size hint. More...
 
cl::NDRange lws_hint () const
 Return the Local-Workgroup-Size hint. More...
 
void set_wbsm_hint (const cl_int &wbsm_hint)
 Set the workgroup batch size modifier hint. More...
 
cl_int wbsm_hint () const
 Return the workgroup batch size modifier hint. More...
 
const std::string & config_id () const
 Get the configuration ID. More...
 
void set_target (GPUTarget target)
 Set the targeted GPU architecture. More...
 
void set_target (cl::Device &device)
 Set the targeted GPU architecture according to the CL device. More...
 
GPUTarget get_target () const
 Get the targeted GPU architecture. More...
 
size_t get_max_workgroup_size ()
 Get the maximum workgroup size for the device the CLKernelLibrary uses. More...
 
template<unsigned int dimension_size>
void add_tensor_argument (unsigned &idx, const ICLTensor *tensor, const Window &window)
 
template<typename T , unsigned int dimension_size>
void add_array_argument (unsigned &idx, const ICLArray< T > *array, const Strides &strides, unsigned int num_dimensions, const Window &window)
 Add the passed array's parameters to the object's kernel's arguments starting from the index idx. More...
 
- Public Member Functions inherited from IKernel
 IKernel ()
 Constructor. More...
 
virtual ~IKernel ()=default
 Destructor. More...
 
virtual bool is_parallelisable () const
 Indicates whether or not the kernel is parallelisable. More...
 
virtual BorderSize border_size () const
 The size of the border for that kernel. More...
 
const Windowwindow () const
 The maximum window the kernel can be executed on. More...
 
bool is_window_configured () const
 Function to check if the embedded window of this kernel has been configured. More...
 

Static Public Member Functions

static Status validate (const ITensorInfo *input, const ITensorInfo *prev_output, const ITensorInfo *output, unsigned int axis, ReductionOperation op)
 Static function to check if given info will lead to a valid configuration of CLArgMinMaxLayerKernel. More...
 
- Static Public Member Functions inherited from ICLKernel
static constexpr unsigned int num_arguments_per_3d_tensor_nhw ()
 Returns the number of arguments enqueued per NHW 3D Tensor object. More...
 
static constexpr unsigned int num_arguments_per_4d_tensor_nhwc ()
 Returns the number of arguments enqueued per NHWC 4D Tensor object. More...
 
static constexpr unsigned int num_arguments_per_1D_array ()
 Returns the number of arguments enqueued per 1D array object. More...
 
static constexpr unsigned int num_arguments_per_1D_tensor ()
 Returns the number of arguments enqueued per 1D tensor object. More...
 
static constexpr unsigned int num_arguments_per_2D_tensor ()
 Returns the number of arguments enqueued per 2D tensor object. More...
 
static constexpr unsigned int num_arguments_per_3D_tensor ()
 Returns the number of arguments enqueued per 3D tensor object. More...
 
static constexpr unsigned int num_arguments_per_4D_tensor ()
 Returns the number of arguments enqueued per 4D tensor object. More...
 
static cl::NDRange gws_from_window (const Window &window)
 Get the global work size given an execution window. More...
 

Detailed Description

Interface for the reduction operation kernel.

Note
The default data type for an uninitialized output tensor is signed 32-bit integer (S32). It is the user's responsibility to check that the results do not overflow because the indices are computed in unsigned 32-bit (U32).

Definition at line 41 of file CLArgMinMaxLayerKernel.h.

Constructor & Destructor Documentation

◆ CLArgMinMaxLayerKernel() [1/3]

Default constructor.

Definition at line 69 of file CLArgMinMaxLayerKernel.cpp.

References arm_compute::ARG_IDX_MAX, and arm_compute::ELEMENTWISE.

70  : _input(nullptr), _prev_output(nullptr), _output(nullptr), _reduction_axis(0), _op(ReductionOperation::ARG_IDX_MAX)
71 {
73 }
Elementwise CL kernel type.
Definition: CLTypes.h:85

◆ CLArgMinMaxLayerKernel() [2/3]

Prevent instances of this class from being copied (As this class contains pointers)

◆ CLArgMinMaxLayerKernel() [3/3]

Allow instances of this class to be moved.

◆ ~CLArgMinMaxLayerKernel()

~CLArgMinMaxLayerKernel ( )
default

Default destructor.

Member Function Documentation

◆ configure() [1/2]

void configure ( const ICLTensor input,
const ICLTensor prev_output,
ICLTensor output,
unsigned int  axis,
ReductionOperation  op 
)

Set the input and output tensors.

Parameters
[in]inputSource tensor. Data types supported: QASYMM8/QASYMM8_SIGNED/S32/F16/F32.
[in]prev_outputDestination tensor of the previous iterations of CLArgMinMaxLayerKernel. Data types supported: U32/S32 Has to be nullptr for the first iteration
[out]outputDestination tensor. Data types supported: U32/S32 Output will have the same number of dimensions as input.
[in]axisAxis along which to reduce. Supported reduction axis : 0,1,2,3
[in]opReduction operation to perform. Only ArgMin and ArgMax are supported.

Definition at line 75 of file CLArgMinMaxLayerKernel.cpp.

References CLKernelLibrary::get().

76 {
77  configure(CLKernelLibrary::get().get_compile_context(), input, prev_output, output, axis, op);
78 }
void configure(const ICLTensor *input, const ICLTensor *prev_output, ICLTensor *output, unsigned int axis, ReductionOperation op)
Set the input and output tensors.
static CLKernelLibrary & get()
Access the KernelLibrary singleton.

◆ configure() [2/2]

void configure ( const CLCompileContext compile_context,
const ICLTensor input,
const ICLTensor prev_output,
ICLTensor output,
unsigned int  axis,
ReductionOperation  op 
)

Set the input and output tensors.

Parameters
[in]compile_contextThe compile context to be used.
[in]inputSource tensor. Data types supported: QASYMM8/QASYMM8_SIGNED/S32/F16/F32.
[in]prev_outputDestination tensor of the previous iterations of CLArgMinMaxLayerKernel. Data types supported: U32/S32 Has to be nullptr for the first iteration
[out]outputDestination tensor. Data types supported: U32/S32 Output will have the same number of dimensions as input.
[in]axisAxis along which to reduce. Supported reduction axis : 0,1,2,3
[in]opReduction operation to perform. Only ArgMin and ArgMax are supported.

Definition at line 80 of file CLArgMinMaxLayerKernel.cpp.

References CLBuildOptions::add_option(), CLBuildOptions::add_option_if(), CLBuildOptions::add_option_if_else(), arm_compute::adjust_vec_size(), arm_compute::ARG_IDX_MAX, ARM_COMPUTE_ERROR, ARM_COMPUTE_ERROR_ON, ARM_COMPUTE_ERROR_ON_NULLPTR, ARM_COMPUTE_ERROR_THROW_ON, arm_compute::auto_init_if_empty(), arm_compute::calculate_max_window(), ICloneable< T >::clone(), arm_compute::create_kernel(), arm_compute::create_lws_hint_parallel_implementations(), ITensorInfo::data_type(), CLKernelLibrary::default_ndrange(), ITensorInfo::dimension(), CLKernelLibrary::get(), arm_compute::get_cl_type_from_data_type(), arm_compute::get_padding_info(), arm_compute::has_padding_changed(), ITensor::info(), arm_compute::test::validation::input, arm_compute::is_data_type_float(), ICLKernel::lws_hint(), CLBuildOptions::options(), arm_compute::test::validation::output_shape, arm_compute::S32, ITensorInfo::tensor_shape(), arm_compute::support::cpp11::to_string(), arm_compute::U, and arm_compute::cpu::kernels::validate_arguments().

81 {
83 
84  TensorShape output_shape{ input->info()->tensor_shape() };
85  output_shape.set(axis, 1);
86  auto_init_if_empty(*output->info(), input->info()->clone()->set_tensor_shape(output_shape).set_data_type(DataType::S32).reset_padding().set_is_resizable(true));
87 
88  ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input->info(), (prev_output != nullptr) ? prev_output->info() : nullptr, output->info(), axis, op));
89 
90  auto padding_info = get_padding_info({ input, prev_output, output });
91 
92  _input = input;
93  _prev_output = prev_output;
94  _output = output;
95  _reduction_axis = axis;
96  _op = op;
97 
98  // Set build options
99  const auto vector_size = (axis == 0) ? 16U : adjust_vec_size(16U, input->info()->dimension(0));
100 
101  CLBuildOptions build_opts;
102  build_opts.add_option_if(_prev_output != nullptr, "-DPREV_OUTPUT");
103  build_opts.add_option("-DDATA_TYPE=" + get_cl_type_from_data_type(input->info()->data_type()));
104  build_opts.add_option("-DVEC_SIZE_LEFTOVER=" + support::cpp11::to_string(input->info()->dimension(0) % vector_size));
105  build_opts.add_option("-DVEC_SIZE=" + support::cpp11::to_string(vector_size));
106  build_opts.add_option_if(is_data_type_float(input->info()->data_type()), "-DFLOAT_DATA_TYPE");
107  build_opts.add_option_if_else(op == ReductionOperation::ARG_IDX_MAX, "-DARG_MAX", "-DARG_MIN");
108  build_opts.add_option("-DDATA_TYPE_OUTPUT=" + get_cl_type_from_data_type(output->info()->data_type()));
109 
110  // Create kernel
112  std::string kernel_axis_name;
113  switch(axis)
114  {
115  case 0:
116  {
117  const ICLTensor *input_for_width = prev_output != nullptr ? _prev_output : _input;
118  build_opts.add_option("-DWIDTH=" + support::cpp11::to_string(input_for_width->info()->dimension(0)));
119 
120  kernel_axis_name = "x";
121  lws_hint = create_lws_hint_parallel_implementations(input_for_width->info()->dimension(0), vector_size);
122  }
123  break;
124  case 1:
125  build_opts.add_option("-DHEIGHT=" + support::cpp11::to_string(input->info()->dimension(1)));
126  kernel_axis_name = "y";
127  break;
128  case 2:
129  build_opts.add_option("-DDEPTH=" + support::cpp11::to_string(input->info()->dimension(2)));
130  kernel_axis_name = "z";
131  break;
132  case 3:
133  build_opts.add_option("-DDEPTH=" + support::cpp11::to_string(input->info()->dimension(2)));
134  build_opts.add_option("-DBATCH=" + support::cpp11::to_string(input->info()->dimension(3)));
135  kernel_axis_name = "w";
136  break;
137  default:
138  ARM_COMPUTE_ERROR("Not supported");
139  }
140  _kernel = create_kernel(compile_context, "arg_min_max_" + kernel_axis_name, build_opts.options());
141 
142  // Configure kernel window
143  Window win = calculate_max_window((prev_output != nullptr) ? (*prev_output->info()) : (*input->info()), Steps(vector_size));
144  ICLKernel::configure_internal(win, lws_hint);
145 
147 }
Window calculate_max_window(const ValidRegion &valid_region, const Steps &steps, bool skip_border, BorderSize border_size)
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352
cl::NDRange lws_hint() const
Return the Local-Workgroup-Size hint.
Definition: ICLKernel.h:383
std::string to_string(T &&value)
Convert integer and float values to string.
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466
static CLKernelLibrary & get()
Access the KernelLibrary singleton.
#define ARM_COMPUTE_ERROR_THROW_ON(status)
Definition: Error.h:455
Status validate_arguments(const ITensorInfo *src, const ITensorInfo *weights, const ITensorInfo *dst, const PadStrideInfo &conv_info)
1 channel, 1 S32 per channel
cl::NDRange default_ndrange() const
Return the default NDRange for the device.
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.
Definition: CLHelpers.cpp:404
std::string get_cl_type_from_data_type(const DataType &dt)
Translates a tensor data type to the appropriate OpenCL type.
Definition: CLHelpers.cpp:39
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::NDRange create_lws_hint_parallel_implementations(unsigned int input_dimension, unsigned int vector_size)
Creates a suitable LWS hint object for parallel implementations.
Definition: CLHelpers.cpp:415
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.
Definition: Utils.cpp:603
std::unordered_map< const ITensorInfo *, PaddingSize > get_padding_info(std::initializer_list< const ITensorInfo *> infos)
Stores padding information before configuring a kernel.
Definition: Utils.cpp:588
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Definition: Validate.h:157
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&#39;s first dimension, getting rounded down to its closest valid vector size.
Definition: Utils.h:1222
bool is_data_type_float(DataType dt)
Check if a given data type is of floating point type.
Definition: Utils.h:1010

◆ operator=() [1/2]

CLArgMinMaxLayerKernel& operator= ( const CLArgMinMaxLayerKernel )
delete

Prevent instances of this class from being copied (As this class contains pointers)

◆ operator=() [2/2]

CLArgMinMaxLayerKernel& operator= ( CLArgMinMaxLayerKernel &&  )
default

Allow instances of this class to be moved.

◆ run()

void run ( const Window window,
cl::CommandQueue &  queue 
)
overridevirtual

Enqueue the OpenCL kernel to process the given window on the passed OpenCL command queue.

Note
The queue is not flushed by this method, and therefore the kernel will not have been executed by the time this method returns.
Parameters
[in]windowRegion on which to execute the kernel. (Must be a valid region of the window returned by window()).
[in,out]queueCommand queue on which to enqueue the kernel.

Reimplemented from ICLKernel.

Definition at line 155 of file CLArgMinMaxLayerKernel.cpp.

References ICLKernel::add_2D_tensor_argument(), ICLKernel::add_3D_tensor_argument(), ICLKernel::add_4D_tensor_argument(), ARM_COMPUTE_ERROR, ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW, ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL, ITensorInfo::dimension(), Window::DimX, Window::DimY, Window::DimZ, ITensorInfo::element_size(), arm_compute::enqueue(), Window::first_slice_window_2D(), Window::first_slice_window_3D(), Window::first_slice_window_4D(), ITensor::info(), ICLKernel::lws_hint(), ICLKernel::num_arguments_per_2D_tensor(), Window::set(), Window::slide_window_slice_2D(), Window::slide_window_slice_3D(), Window::slide_window_slice_4D(), and IKernel::window().

156 {
159 
160  switch(_reduction_axis)
161  {
162  case 0:
163  {
164  // Set out window
165  Window out_window(window);
166  out_window.set(Window::DimX, Window::Dimension(0, 0, 0));
167 
168  // Get first input and output slices
169  Window in_slice = window.first_slice_window_2D();
170  Window out_slice = out_window.first_slice_window_2D();
171 
172  // Reshape window
173  const unsigned int num_tensors = _prev_output != nullptr ? 3 : 2;
174 
175  // Set local sums buffer
176  unsigned int local_res_size = lws_hint()[0] * _output->info()->element_size();
177  _kernel.setArg(num_arguments_per_2D_tensor() * num_tensors, local_res_size, nullptr);
178  do
179  {
180  unsigned int idx = 0;
181  add_2D_tensor_argument(idx, _input, in_slice);
182  if(_prev_output != nullptr)
183  {
184  add_2D_tensor_argument(idx, _prev_output, in_slice);
185  }
186  add_2D_tensor_argument(idx, _output, out_slice);
187  enqueue(queue, *this, in_slice, lws_hint());
188  }
189  while(window.slide_window_slice_2D(in_slice) && window.slide_window_slice_2D(out_slice));
190  }
191  break;
192  case 1:
193  {
194  // Get first input and output slices
195  Window window_in{ window };
196  window_in.set(Window::DimY, Window::Dimension(0, _input->info()->dimension(1), _input->info()->dimension(1)));
197  Window in_slice = window_in.first_slice_window_2D();
198  Window out_slice = window.first_slice_window_2D();
199 
200  do
201  {
202  unsigned int idx = 0;
203  add_2D_tensor_argument(idx, _input, in_slice);
204  add_2D_tensor_argument(idx, _output, out_slice);
205  enqueue(queue, *this, in_slice, lws_hint());
206  }
207  while(window_in.slide_window_slice_2D(in_slice) && window.slide_window_slice_2D(out_slice));
208  }
209  break;
210  case 2:
211  {
212  // Get first input and output slices
213  Window window_in{ window };
214  window_in.set(Window::DimZ, Window::Dimension(0, _input->info()->dimension(2), _input->info()->dimension(2)));
215  Window in_slice = window_in.first_slice_window_3D();
216  Window out_slice = window.first_slice_window_3D();
217 
218  do
219  {
220  unsigned int idx = 0;
221  add_3D_tensor_argument(idx, _input, in_slice);
222  add_3D_tensor_argument(idx, _output, out_slice);
223  enqueue(queue, *this, in_slice, lws_hint());
224  }
225  while(window_in.slide_window_slice_3D(in_slice) && window.slide_window_slice_3D(out_slice));
226  }
227  break;
228  case 3:
229  {
230  // Get first input and output slices
231  Window window_in{ window };
232  window_in.set(3, Window::Dimension(0, 1, 1));
233  Window in_slice = window_in.first_slice_window_4D();
234  Window out_slice = window.first_slice_window_4D();
235 
236  do
237  {
238  unsigned int idx = 0;
239  add_4D_tensor_argument(idx, _input, in_slice);
240  add_4D_tensor_argument(idx, _output, out_slice);
241  enqueue(queue, *this, in_slice, lws_hint());
242  }
243  while(window_in.slide_window_slice_4D(in_slice) && window.slide_window_slice_4D(out_slice));
244  }
245  break;
246  default:
247  ARM_COMPUTE_ERROR("Not supported");
248  }
249 }
Window first_slice_window_2D() const
First 2D slice of the window.
Definition: Window.h:297
const Window & window() const
The maximum window the kernel can be executed on.
Definition: IKernel.cpp:28
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.
Definition: ICLKernel.cpp:32
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352
cl::NDRange lws_hint() const
Return the Local-Workgroup-Size hint.
Definition: ICLKernel.h:383
void add_3D_tensor_argument(unsigned int &idx, const ICLTensor *tensor, const Window &window)
Add the passed 3D tensor&#39;s parameters to the object&#39;s kernel&#39;s arguments starting from the index idx...
Definition: ICLKernel.h:226
bool slide_window_slice_2D(Window &slice) const
Slide the passed 2D window slice.
Definition: Window.h:337
static constexpr size_t DimX
Alias for dimension 0 also known as X dimension.
Definition: Window.h:43
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor&#39;s metadata.
virtual size_t element_size() const =0
Element size in bytes calculated as data_size() * num_channels()
void set(size_t dimension, const Dimension &dim)
Set the values of a given dimension.
Definition: Window.inl:49
static constexpr unsigned int num_arguments_per_2D_tensor()
Returns the number of arguments enqueued per 2D tensor object.
Definition: ICLKernel.h:305
bool slide_window_slice_3D(Window &slice) const
Slide the passed 3D window slice.
Definition: Window.h:349
#define ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(k)
Definition: Validate.h:915
static constexpr size_t DimY
Alias for dimension 1 also known as Y dimension.
Definition: Window.h:45
void add_2D_tensor_argument(unsigned int &idx, const ICLTensor *tensor, const Window &window)
Add the passed 2D tensor&#39;s parameters to the object&#39;s kernel&#39;s arguments starting from the index idx...
Definition: ICLKernel.h:202
static constexpr size_t DimZ
Alias for dimension 2 also known as Z dimension.
Definition: Window.h:47
Window first_slice_window_4D() const
First 4D slice of the window.
Definition: Window.h:313
bool slide_window_slice_4D(Window &slice) const
Slide the passed 4D window slice.
Definition: Window.h:361
Window first_slice_window_3D() const
First 3D slice of the window.
Definition: Window.h:305
void add_4D_tensor_argument(unsigned int &idx, const ICLTensor *tensor, const Window &window)
Add the passed 4D tensor&#39;s parameters to the object&#39;s kernel&#39;s arguments starting from the index idx...
Definition: ICLKernel.h:236
#define ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(f, s)
Definition: Validate.h:201

◆ validate()

Status validate ( const ITensorInfo input,
const ITensorInfo prev_output,
const ITensorInfo output,
unsigned int  axis,
ReductionOperation  op 
)
static

Static function to check if given info will lead to a valid configuration of CLArgMinMaxLayerKernel.

Parameters
[in]inputSource tensor info. Data types supported: QASYMM8/QASYMM8_SIGNED/S32/F16/F32.
[in]prev_outputDestination tensor info of the previous iterations. Data types supported: U32/S32 Has to be nullptr for the first iteration
[in]outputDestination tensor info. Data types supported: U32/S32 Output will have the same number of dimensions as input.
[in]axisAxis along which to reduce. Supported reduction axis : 0,1,2,3
[in]opReduction operation to perform. Only ArgMin and ArgMax are supported.
Returns
a status

Definition at line 149 of file CLArgMinMaxLayerKernel.cpp.

References ARM_COMPUTE_RETURN_ON_ERROR, and arm_compute::cpu::kernels::validate_arguments().

Referenced by CLArgMinMaxLayer::validate().

150 {
151  ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(input, prev_output, output, axis, op));
152  return Status{};
153 }
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Definition: Error.h:204
Status validate_arguments(const ITensorInfo *src, const ITensorInfo *weights, const ITensorInfo *dst, const PadStrideInfo &conv_info)

The documentation for this class was generated from the following files: