Compute Library
 21.02
CLPriorBoxLayer Class Reference

Basic function to run CLPriorBoxLayerKernel. More...

#include <CLPriorBoxLayer.h>

Collaboration diagram for CLPriorBoxLayer:
[legend]

Public Member Functions

 CLPriorBoxLayer ()
 Constructor. More...
 
void configure (const ICLTensor *input1, const ICLTensor *input2, ICLTensor *output, const PriorBoxLayerInfo &info)
 Set the input and output tensors. More...
 
void configure (const CLCompileContext &compile_context, const ICLTensor *input1, const ICLTensor *input2, ICLTensor *output, const PriorBoxLayerInfo &info)
 Set the input and output tensors. More...
 
- Public Member Functions inherited from ICLSimpleFunction
 ICLSimpleFunction (CLRuntimeContext *ctx=nullptr)
 Constructor. More...
 
 ICLSimpleFunction (const ICLSimpleFunction &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 ICLSimpleFunction (ICLSimpleFunction &&)=default
 Default move constructor. More...
 
ICLSimpleFunctionoperator= (const ICLSimpleFunction &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
ICLSimpleFunctionoperator= (ICLSimpleFunction &&)=default
 Default move assignment operator. More...
 
 ~ICLSimpleFunction ()
 Default destructor. More...
 
void run () override final
 Run the kernels contained in the function. More...
 
- Public Member Functions inherited from IFunction
virtual ~IFunction ()=default
 Destructor. More...
 
virtual void prepare ()
 Prepare the function for executing. 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 CLPriorBoxLayer. More...
 

Detailed Description

Basic function to run CLPriorBoxLayerKernel.

Definition at line 39 of file CLPriorBoxLayer.h.

Constructor & Destructor Documentation

◆ CLPriorBoxLayer()

Constructor.

Definition at line 37 of file CLPriorBoxLayer.cpp.

38  : _min(nullptr), _max(nullptr), _aspect_ratios(nullptr)
39 {
40 }

Member Function Documentation

◆ configure() [1/2]

void configure ( const ICLTensor input1,
const ICLTensor input2,
ICLTensor 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 types and layouts supported: same as input1
[in]infoPrior box layer info.

Definition at line 42 of file CLPriorBoxLayer.cpp.

References CLKernelLibrary::get().

43 {
44  configure(CLKernelLibrary::get().get_compile_context(), input1, input2, output, info);
45 }
void configure(const ICLTensor *input1, const ICLTensor *input2, ICLTensor *output, const PriorBoxLayerInfo &info)
Set the input and output tensors.
static CLKernelLibrary & get()
Access the KernelLibrary singleton.

◆ configure() [2/2]

void configure ( const CLCompileContext compile_context,
const ICLTensor input1,
const ICLTensor input2,
ICLTensor output,
const PriorBoxLayerInfo info 
)

Set the input and output tensors.

Parameters
[in]compile_contextThe compile context to be used.
[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 types and layouts supported: same as input1
[in]infoPrior box layer info.

Definition at line 47 of file CLPriorBoxLayer.cpp.

References PriorBoxLayerInfo::aspect_ratios(), CLScheduler::get(), PriorBoxLayerInfo::max_sizes(), and PriorBoxLayerInfo::min_sizes().

48 {
49  _min = cl::Buffer(CLScheduler::get().context(), CL_MEM_ALLOC_HOST_PTR | CL_MEM_READ_WRITE, info.min_sizes().size() * sizeof(float));
50  _aspect_ratios = cl::Buffer(CLScheduler::get().context(), CL_MEM_ALLOC_HOST_PTR | CL_MEM_READ_WRITE, info.aspect_ratios().size() * sizeof(float));
51  if(!info.max_sizes().empty())
52  {
53  _max = cl::Buffer(CLScheduler::get().context(), CL_MEM_ALLOC_HOST_PTR | CL_MEM_READ_WRITE, info.max_sizes().size() * sizeof(float));
54  }
55 
56  auto k = std::make_unique<CLPriorBoxLayerKernel>();
57  k->configure(compile_context, input1, input2, output, info, &_min, &_max, &_aspect_ratios);
58  _kernel = std::move(k);
59 }
static CLScheduler & get()
Access the scheduler singleton.
std::vector< float > aspect_ratios() const
Get aspect ratios.
Definition: Types.h:944
std::vector< float > max_sizes() const
Get max sizes.
Definition: Types.h:939
std::vector< float > min_sizes() const
Get min sizes.
Definition: Types.h:904

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

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 types and layouts supported: same as input1
[in]infoPrior box layer info.
Returns
a status

Definition at line 61 of file CLPriorBoxLayer.cpp.

References CLPriorBoxLayerKernel::validate().

Referenced by arm_compute::test::validation::DATA_TEST_CASE().

62 {
63  return CLPriorBoxLayerKernel::validate(input1, input2, output, info);
64 }
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 CLPriorBoxLayerKernel.

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