Compute Library
 21.02
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...
 
- 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...
 

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...
 

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 79 of file NEPriorBoxLayerKernel.cpp.

Referenced by NEPriorBoxLayerKernel::name().

80  : _input1(nullptr), _input2(nullptr), _output(nullptr), _info()
81 {
82 }

◆ 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.

Referenced by NEPriorBoxLayerKernel::name().

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 200 of file NEPriorBoxLayerKernel.cpp.

References ARM_COMPUTE_ERROR_ON_NULLPTR, ARM_COMPUTE_ERROR_THROW_ON, PriorBoxLayerInfo::aspect_ratios(), arm_compute::calculate_max_window(), ITensor::info(), arm_compute::test::validation::info, PriorBoxLayerInfo::max_sizes(), PriorBoxLayerInfo::min_sizes(), ITensorInfo::num_dimensions(), Dimensions< T >::set_num_dimensions(), ITensorInfo::set_valid_region(), ITensorInfo::tensor_shape(), and arm_compute::validate_arguments().

Referenced by NEPriorBoxLayerKernel::name().

201 {
202  ARM_COMPUTE_ERROR_ON_NULLPTR(input1, input2, output);
203 
204  ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input1->info(), input2->info(), output->info(), info));
205 
206  _input1 = input1;
207  _input2 = input2;
208  _info = info;
209  _output = output;
210 
211  // Configure kernel window
212  const int num_priors = info.aspect_ratios().size() * info.min_sizes().size() + info.max_sizes().size();
213  Window win = calculate_max_window(*output->info(), Steps(num_priors * 4));
214  Coordinates coord;
215  coord.set_num_dimensions(output->info()->num_dimensions());
216  output->info()->set_valid_region(ValidRegion(coord, output->info()->tensor_shape()));
217 
218  INEKernel::configure(win);
219 }
Window calculate_max_window(const ValidRegion &valid_region, const Steps &steps, bool skip_border, BorderSize border_size)
#define ARM_COMPUTE_ERROR_THROW_ON(status)
Definition: Error.h:455
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
Status validate_arguments(const ITensorInfo *input, const ITensorInfo *bias, const ITensorInfo *output, const GEMMLowpOutputStageInfo *output_stage)
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Definition: Validate.h:161

◆ name()

◆ operator=() [1/2]

NEPriorBoxLayerKernel& operator= ( const NEPriorBoxLayerKernel )
delete

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

Referenced by NEPriorBoxLayerKernel::name().

◆ 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 228 of file NEPriorBoxLayerKernel.cpp.

References ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW, ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL, ARM_COMPUTE_UNUSED, and IKernel::window().

Referenced by NEPriorBoxLayerKernel::name().

229 {
233 
234  // Run function
235  calculate_prior_boxes(window);
236 }
const Window & window() const
The maximum window the kernel can be executed on.
Definition: IKernel.cpp:28
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Definition: Error.h:152
#define ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(k)
Definition: Validate.h:941
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
#define ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(f, s)
Definition: Validate.h:205

◆ 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 221 of file NEPriorBoxLayerKernel.cpp.

References ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR, ARM_COMPUTE_RETURN_ON_ERROR, and arm_compute::validate_arguments().

Referenced by NEPriorBoxLayerKernel::name(), and NEPriorBoxLayer::validate().

222 {
223  ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(input1, input2, output);
224  ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(input1, input2, output, info));
225 
226  return Status{};
227 }
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Definition: Error.h:204
#define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...)
Definition: Validate.h:163
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
Status validate_arguments(const ITensorInfo *input, const ITensorInfo *bias, const ITensorInfo *output, const GEMMLowpOutputStageInfo *output_stage)

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