Compute Library
 19.08
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...
 
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...
 
- 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 91 of file NEPriorBoxLayerKernel.cpp.

92  : _input1(nullptr), _input2(nullptr), _output(nullptr), _info()
93 {
94 }

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

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

213 {
214  ARM_COMPUTE_ERROR_ON_NULLPTR(input1, input2, output);
215 
216  ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input1->info(), input2->info(), output->info(), info));
217 
218  _input1 = input1;
219  _input2 = input2;
220  _info = info;
221  _output = output;
222 
223  // Configure kernel window
224  auto win_config = validate_and_configure_window(input1->info(), input2->info(), output->info(), info);
225  ARM_COMPUTE_ERROR_THROW_ON(win_config.first);
226  INEKernel::configure(win_config.second);
227 }
std::pair< Status, Window > validate_and_configure_window(ITensorInfo *input, ITensorInfo *weights, ITensorInfo *biases, ITensorInfo *output, const PadStrideInfo &conv_info, unsigned int depth_multiplier, const Size2D &dilation)
#define ARM_COMPUTE_ERROR_THROW_ON(status)
Definition: Error.h:327
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Definition: Validate.h:161

References ARM_COMPUTE_ERROR_ON_NULLPTR, ARM_COMPUTE_ERROR_THROW_ON, ITensor::info(), arm_compute::test::validation::info, and arm_compute::validate_and_configure_window().

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

Implements ICPPKernel.

Definition at line 238 of file NEPriorBoxLayerKernel.cpp.

239 {
243 
244  // Run function
245  calculate_prior_boxes(window);
246 }
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:160
#define ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(f, s)
Definition: Validate.h:205
#define ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(k)
Definition: Validate.h:940

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

230 {
231  ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(input1, input2, output);
232  ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(input1, input2, output, info));
233  ARM_COMPUTE_RETURN_ON_ERROR(validate_and_configure_window(input1->clone().get(), input2->clone().get(), output->clone().get(), info)
234  .first);
235 
236  return Status{};
237 }
std::pair< Status, Window > validate_and_configure_window(ITensorInfo *input, ITensorInfo *weights, ITensorInfo *biases, ITensorInfo *output, const PadStrideInfo &conv_info, unsigned int depth_multiplier, const Size2D &dilation)
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Definition: Error.h:193
#define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...)
Definition: Validate.h:163

References ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR, ARM_COMPUTE_RETURN_ON_ERROR, ICloneable< T >::clone(), arm_compute::test::validation::info, and arm_compute::validate_and_configure_window().

Referenced by NEPriorBoxLayer::validate().


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