Compute Library
 23.11
NEPriorBoxLayerKernel Class Reference

Interface for the kernel to calculate prior boxes. More...

#include <NEPriorBoxLayerKernel.h>

Collaboration diagram for NEPriorBoxLayerKernel:
[legend]

Public Member Functions

const char * name () const override
 Name of the kernel. More...
 
 NEPriorBoxLayerKernel ()
 Default constructor. More...
 
 NEPriorBoxLayerKernel (const NEPriorBoxLayerKernel &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
NEPriorBoxLayerKerneloperator= (const NEPriorBoxLayerKernel &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 NEPriorBoxLayerKernel (NEPriorBoxLayerKernel &&)=default
 Allow instances of this class to be moved. More...
 
NEPriorBoxLayerKerneloperator= (NEPriorBoxLayerKernel &&)=default
 Allow instances of this class to be moved. More...
 
 ~NEPriorBoxLayerKernel ()=default
 Default destructor. More...
 
void configure (const ITensor *input1, const ITensor *input2, ITensor *output, const PriorBoxLayerInfo &info)
 Set the input and output tensors. More...
 
void run (const Window &window, const ThreadInfo &info) override
 Execute the kernel on the passed window. More...
 
- Public Member Functions inherited from ICPPKernel
virtual ~ICPPKernel ()=default
 Default destructor. More...
 
virtual void run_nd (const Window &window, const ThreadInfo &info, const Window &thread_locator)
 legacy compatibility layer for implemantions which do not support thread_locator In these cases we simply narrow the interface down the legacy version More...
 
virtual void run_op (ITensorPack &tensors, const Window &window, const ThreadInfo &info)
 Execute the kernel on the passed window. More...
 
virtual size_t get_mws (const CPUInfo &platform, size_t thread_count) const
 Return minimum workload size of the relevant kernel. 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 *input1, const ITensorInfo *input2, const ITensorInfo *output, const PriorBoxLayerInfo &info)
 Static function to check if given info will lead to a valid configuration of NEPriorBoxLayerKernel. More...
 

Additional Inherited Members

- Static Public Attributes inherited from ICPPKernel
static constexpr size_t default_mws = 1
 

Detailed Description

Interface for the kernel to calculate prior boxes.

Definition at line 34 of file NEPriorBoxLayerKernel.h.

Constructor & Destructor Documentation

◆ NEPriorBoxLayerKernel() [1/3]

Default constructor.

Definition at line 85 of file NEPriorBoxLayerKernel.cpp.

85  : _input1(nullptr), _input2(nullptr), _output(nullptr), _info()
86 {
87 }

◆ NEPriorBoxLayerKernel() [2/3]

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

◆ NEPriorBoxLayerKernel() [3/3]

Allow instances of this class to be moved.

◆ ~NEPriorBoxLayerKernel()

~NEPriorBoxLayerKernel ( )
default

Default destructor.

Member Function Documentation

◆ configure()

void configure ( const ITensor input1,
const ITensor input2,
ITensor output,
const PriorBoxLayerInfo info 
)

Set the input and output tensors.

Parameters
[in]input1First source tensor. Data types supported: F32. Data layouts supported: NCHW/NHWC.
[in]input2Second source tensor. Data types and layouts supported: same as input1
[out]outputDestination tensor. Output dimensions are [W * H * num_priors * 4, 2]. Data type supported: same as input
[in]infoPrior box layer info.

Definition at line 214 of file NEPriorBoxLayerKernel.cpp.

218 {
219  ARM_COMPUTE_ERROR_ON_NULLPTR(input1, input2, output);
220 
221  ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input1->info(), input2->info(), output->info(), info));
222 
223  _input1 = input1;
224  _input2 = input2;
225  _info = info;
226  _output = output;
227 
228  // Configure kernel window
229  const int num_priors = info.aspect_ratios().size() * info.min_sizes().size() + info.max_sizes().size();
230  Window win = calculate_max_window(*output->info(), Steps(num_priors * 4));
231 
232  INEKernel::configure(win);
233 }

References ARM_COMPUTE_ERROR_ON_NULLPTR, ARM_COMPUTE_ERROR_THROW_ON, arm_compute::calculate_max_window(), ITensor::info(), arm_compute::test::validation::info, and arm_compute::cpu::kernels::validate_arguments().

◆ name()

const char* name ( ) const
inlineoverridevirtual

Name of the kernel.

Returns
Kernel name

Implements ICPPKernel.

Definition at line 37 of file NEPriorBoxLayerKernel.h.

38  {
39  return "NEPriorBoxLayerKernel";
40  }

◆ operator=() [1/2]

NEPriorBoxLayerKernel& operator= ( const NEPriorBoxLayerKernel )
delete

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

◆ operator=() [2/2]

NEPriorBoxLayerKernel& operator= ( NEPriorBoxLayerKernel &&  )
default

Allow instances of this class to be moved.

◆ run()

void run ( const Window window,
const ThreadInfo info 
)
overridevirtual

Execute the kernel on the passed window.

Warning
If is_parallelisable() returns false then the passed window must be equal to window()
Note
The window has to be a region within the window returned by the window() method
The width of the window has to be a multiple of num_elems_processed_per_iteration().
Parameters
[in]windowRegion on which to execute the kernel. (Must be a region of the window returned by window())
[in]infoInfo about executing thread and CPU.

Reimplemented from ICPPKernel.

Definition at line 245 of file NEPriorBoxLayerKernel.cpp.

246 {
250 
251  // Run function
252  calculate_prior_boxes(window);
253 }

References ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW, ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL, ARM_COMPUTE_UNUSED, arm_compute::test::validation::info, and IKernel::window().

◆ validate()

Status validate ( const ITensorInfo input1,
const ITensorInfo input2,
const ITensorInfo output,
const PriorBoxLayerInfo info 
)
static

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

Parameters
[in]input1First source tensor info. Data types supported: F32. Data layouts supported: NCHW/NHWC.
[in]input2Second source tensor info. Data types and layouts supported: same as input1
[in]outputDestination tensor info. Output dimensions are [W * H * num_priors * 4, 2]. Data type supported: same as input
[in]infoPrior box layer info.
Returns
a status

Definition at line 235 of file NEPriorBoxLayerKernel.cpp.

239 {
240  ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(input1, input2, output);
241  ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(input1, input2, output, info));
242 
243  return Status{};
244 }

References ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR, ARM_COMPUTE_RETURN_ON_ERROR, arm_compute::test::validation::info, and arm_compute::cpu::kernels::validate_arguments().

Referenced by NEPriorBoxLayer::validate().


The documentation for this class was generated from the following files:
arm_compute::calculate_max_window
Window calculate_max_window(const ValidRegion &valid_region, const Steps &steps, bool skip_border, BorderSize border_size)
Definition: WindowHelpers.cpp:29
arm_compute::cpu::kernels::validate_arguments
Status validate_arguments(const ITensorInfo *src, const ITensorInfo *weights, const ITensorInfo *dst, const PadStrideInfo &conv_info)
Definition: CpuDirectConv2dKernel.cpp:57
ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL
#define ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(k)
Definition: Validate.h:1079
ARM_COMPUTE_RETURN_ON_ERROR
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Definition: Error.h:205
ARM_COMPUTE_ERROR_ON_NULLPTR
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Definition: Validate.h:159
ARM_COMPUTE_ERROR_THROW_ON
#define ARM_COMPUTE_ERROR_THROW_ON(status)
Definition: Error.h:455
ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW
#define ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(f, s)
Definition: Validate.h:203
ARM_COMPUTE_UNUSED
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Definition: Error.h:151
arm_compute::IKernel::window
const Window & window() const
The maximum window the kernel can be executed on.
Definition: IKernel.cpp:28
ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR
#define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...)
Definition: Validate.h:161
arm_compute::test::validation::info
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)