Compute Library
 21.02
CLBatchToSpaceLayer Class Reference

Basic function to run CLBatchToSpaceLayerKernel. More...

#include <CLBatchToSpaceLayer.h>

Collaboration diagram for CLBatchToSpaceLayer:
[legend]

Public Member Functions

 CLBatchToSpaceLayer ()
 Default constructor. More...
 
 CLBatchToSpaceLayer (const CLBatchToSpaceLayer &)=delete
 Prevent instances of this class from being copied. More...
 
CLBatchToSpaceLayeroperator= (const CLBatchToSpaceLayer &)=delete
 Prevent instances of this class from being copied. More...
 
 CLBatchToSpaceLayer (CLBatchToSpaceLayer &&)=delete
 Prevent instances of this class to be moved. More...
 
CLBatchToSpaceLayeroperator= (CLBatchToSpaceLayer &&)=delete
 Prevent instances of this class to be moved. More...
 
 ~CLBatchToSpaceLayer ()
 Default destructor. More...
 
void configure (const ICLTensor *input, const ICLTensor *block_shape, ICLTensor *output)
 Set the input and output tensors. More...
 
void configure (const CLCompileContext &compile_context, const ICLTensor *input, const ICLTensor *block_shape, ICLTensor *output)
 Set the input and output tensors. More...
 
void configure (const ICLTensor *input, int32_t block_shape_x, int32_t block_shape_y, ICLTensor *output)
 Set the input and output tensors. More...
 
void configure (const CLCompileContext &compile_context, const ICLTensor *input, int32_t block_shape_x, int32_t block_shape_y, ICLTensor *output)
 Set the input and output tensors. More...
 
void run () override
 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 *input, const ITensorInfo *block_shape, const ITensorInfo *output)
 Static function to check if given info will lead to a valid configuration of CLBatchToSpaceLayer. More...
 
static Status validate (const ITensorInfo *input, int32_t block_shape_x, int32_t block_shape_y, const ITensorInfo *output)
 Static function to check if given info will lead to a valid configuration of CLBatchToSpaceLayer (Static block shape). More...
 

Detailed Description

Basic function to run CLBatchToSpaceLayerKernel.

Definition at line 41 of file CLBatchToSpaceLayer.h.

Constructor & Destructor Documentation

◆ CLBatchToSpaceLayer() [1/3]

Default constructor.

Definition at line 37 of file CLBatchToSpaceLayer.cpp.

References CLBatchToSpaceLayer::~CLBatchToSpaceLayer().

38  : _batch_to_space_kernel(std::make_unique<CLBatchToSpaceLayerKernel>())
39 {
40 }

◆ CLBatchToSpaceLayer() [2/3]

Prevent instances of this class from being copied.

◆ CLBatchToSpaceLayer() [3/3]

Prevent instances of this class to be moved.

◆ ~CLBatchToSpaceLayer()

~CLBatchToSpaceLayer ( )
default

Default destructor.

Referenced by CLBatchToSpaceLayer::CLBatchToSpaceLayer().

Member Function Documentation

◆ configure() [1/4]

void configure ( const ICLTensor input,
const ICLTensor block_shape,
ICLTensor output 
)

Set the input and output tensors.

Parameters
[in]inputTensor input. Supported tensor rank: 4. Data types supported: All.
[in]block_shape1-D tensor with shape [M]. Data types supported: S32
[out]outputTensor output. Data types supported: same as input

Definition at line 44 of file CLBatchToSpaceLayer.cpp.

References CLKernelLibrary::get().

Referenced by CLBatchToSpaceLayer::configure().

45 {
46  configure(CLKernelLibrary::get().get_compile_context(), input, block_shape, output);
47 }
static CLKernelLibrary & get()
Access the KernelLibrary singleton.
void configure(const ICLTensor *input, const ICLTensor *block_shape, ICLTensor *output)
Set the input and output tensors.

◆ configure() [2/4]

void configure ( const CLCompileContext compile_context,
const ICLTensor input,
const ICLTensor block_shape,
ICLTensor output 
)

Set the input and output tensors.

Parameters
[in]compile_contextThe compile context to be used.
[in]inputTensor input. Supported tensor rank: 4. Data types supported: All.
[in]block_shape1-D tensor with shape [M]. Data types supported: S32
[out]outputTensor output. Data types supported: same as input

Definition at line 49 of file CLBatchToSpaceLayer.cpp.

50 {
51  _batch_to_space_kernel->configure(compile_context, input, block_shape, output);
52 }

◆ configure() [3/4]

void configure ( const ICLTensor input,
int32_t  block_shape_x,
int32_t  block_shape_y,
ICLTensor output 
)

Set the input and output tensors.

(Static block shape).

Parameters
[in]inputTensor input. Supported tensor rank: 4. Data types supported: All.
[in]block_shape_xBlock shape x value.
[in]block_shape_yBlock shape y value.
[out]outputTensor output. Data types supported: same as input

Definition at line 54 of file CLBatchToSpaceLayer.cpp.

References CLBatchToSpaceLayer::configure(), and CLKernelLibrary::get().

55 {
56  configure(CLKernelLibrary::get().get_compile_context(), input, block_shape_x, block_shape_y, output);
57 }
static CLKernelLibrary & get()
Access the KernelLibrary singleton.
void configure(const ICLTensor *input, const ICLTensor *block_shape, ICLTensor *output)
Set the input and output tensors.

◆ configure() [4/4]

void configure ( const CLCompileContext compile_context,
const ICLTensor input,
int32_t  block_shape_x,
int32_t  block_shape_y,
ICLTensor output 
)

Set the input and output tensors.

(Static block shape).

Parameters
[in]compile_contextThe compile context to be used.
[in]inputTensor input. Supported tensor rank: 4. Data types supported: All.
[in]block_shape_xBlock shape x value.
[in]block_shape_yBlock shape y value.
[out]outputTensor output. Data types supported: same as input

Definition at line 59 of file CLBatchToSpaceLayer.cpp.

60 {
61  _batch_to_space_kernel->configure(compile_context, input, block_shape_x, block_shape_y, output);
62 }

◆ operator=() [1/2]

CLBatchToSpaceLayer& operator= ( const CLBatchToSpaceLayer )
delete

Prevent instances of this class from being copied.

◆ operator=() [2/2]

CLBatchToSpaceLayer& operator= ( CLBatchToSpaceLayer &&  )
delete

Prevent instances of this class to be moved.

◆ run()

void run ( )
overridevirtual

Run the kernels contained in the function.

For Neon kernels:

  • Multi-threading is used for the kernels which are parallelisable.
  • By default std::thread::hardware_concurrency() threads are used.
Note
CPPScheduler::set_num_threads() can be used to manually set the number of threads

For OpenCL kernels:

  • All the kernels are enqueued on the queue associated with CLScheduler.
  • The queue is then flushed.
Note
The function will not block until the kernels are executed. It is the user's responsibility to wait.
Will call prepare() on first run if hasn't been done

Implements IFunction.

Definition at line 74 of file CLBatchToSpaceLayer.cpp.

References CLScheduler::enqueue(), and CLScheduler::get().

75 {
76  CLScheduler::get().enqueue(*_batch_to_space_kernel, true);
77 }
static CLScheduler & get()
Access the scheduler singleton.
void enqueue(ICLKernel &kernel, bool flush=true)
Schedule the execution of the passed kernel if possible.

◆ validate() [1/2]

Status validate ( const ITensorInfo input,
const ITensorInfo block_shape,
const ITensorInfo output 
)
static

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

Parameters
[in]inputTensor input info. Supported tensor rank: 4. Data types supported: All.
[in]block_shapeblock shape tensor info with shape [M]. Data types supported: S32
[out]outputTensor output info. Data types supported: same as input
Returns
a status

Definition at line 64 of file CLBatchToSpaceLayer.cpp.

References CLBatchToSpaceLayerKernel::validate().

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

65 {
66  return CLBatchToSpaceLayerKernel::validate(input, block_shape, output);
67 }
static Status validate(const ITensorInfo *input, const ITensorInfo *block_shape, const ITensorInfo *output)
Static function to check if given info will lead to a valid configuration of CLBatchToSpaceLayerKerne...

◆ validate() [2/2]

Status validate ( const ITensorInfo input,
int32_t  block_shape_x,
int32_t  block_shape_y,
const ITensorInfo output 
)
static

Static function to check if given info will lead to a valid configuration of CLBatchToSpaceLayer (Static block shape).

Parameters
[in]inputTensor input info. Supported tensor rank: 4. Data types supported: All.
[in]block_shape_xBlock shape x value.
[in]block_shape_yBlock shape y value.
[out]outputTensor output info. Data types supported: same as input
Returns
a status

Definition at line 69 of file CLBatchToSpaceLayer.cpp.

References CLBatchToSpaceLayerKernel::validate().

70 {
71  return CLBatchToSpaceLayerKernel::validate(input, block_shape_x, block_shape_y, output);
72 }
static Status validate(const ITensorInfo *input, const ITensorInfo *block_shape, const ITensorInfo *output)
Static function to check if given info will lead to a valid configuration of CLBatchToSpaceLayerKerne...

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