Compute Library
 19.08
NEDepthConcatenateLayerKernel Class Reference

Interface for the depth concatenate kernel. More...

#include <NEDepthConcatenateLayerKernel.h>

Collaboration diagram for NEDepthConcatenateLayerKernel:
[legend]

Public Member Functions

const char * name () const override
 Name of the kernel. More...
 
 NEDepthConcatenateLayerKernel ()
 Default constructor. More...
 
 NEDepthConcatenateLayerKernel (const NEDepthConcatenateLayerKernel &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
NEDepthConcatenateLayerKerneloperator= (const NEDepthConcatenateLayerKernel &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 NEDepthConcatenateLayerKernel (NEDepthConcatenateLayerKernel &&)=default
 Allow instances of this class to be moved. More...
 
NEDepthConcatenateLayerKerneloperator= (NEDepthConcatenateLayerKernel &&)=default
 Allow instances of this class to be moved. More...
 
 ~NEDepthConcatenateLayerKernel ()=default
 Default destructor. More...
 
void configure (const ITensor *input, unsigned int depth_offset, ITensor *output)
 Initialise the kernel's inputs and output. 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 *input, unsigned int depth_offset, const ITensorInfo *output)
 Static function to check if given info will lead to a valid configuration of NEDepthConcatenateLayerKernel. More...
 

Detailed Description

Interface for the depth concatenate kernel.

The input tensor will be concatenated into the output tensor.

Definition at line 37 of file NEDepthConcatenateLayerKernel.h.

Constructor & Destructor Documentation

◆ NEDepthConcatenateLayerKernel() [1/3]

Default constructor.

Definition at line 117 of file NEDepthConcatenateLayerKernel.cpp.

118  : _func(nullptr), _input(nullptr), _output(nullptr), _depth_offset(0)
119 {
120 }

◆ NEDepthConcatenateLayerKernel() [2/3]

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

◆ NEDepthConcatenateLayerKernel() [3/3]

Allow instances of this class to be moved.

◆ ~NEDepthConcatenateLayerKernel()

Default destructor.

Member Function Documentation

◆ configure()

void configure ( const ITensor input,
unsigned int  depth_offset,
ITensor output 
)

Initialise the kernel's inputs and output.

Parameters
[in]inputInput tensor. Data types supported: QASYMM8/F16/F32.
[in]depth_offsetThe offset on the Z axis.
[in,out]outputOutput tensor. Data types supported: Same as input.
Note
: The output tensor's low two dimensions can't be smaller than the input one's.
: The gaps between the two lowest dimensions of input and output need to be divisible by 2.

Definition at line 122 of file NEDepthConcatenateLayerKernel.cpp.

123 {
124  ARM_COMPUTE_ERROR_ON_NULLPTR(input, output);
125  ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input->info(), depth_offset, output->info()));
126 
127  _func = nullptr;
128  _input = input;
129  _output = output;
130  _depth_offset = depth_offset;
131 
132  switch(input->info()->data_type())
133  {
134  case DataType::QASYMM8:
135  _func = &depth_concat<uint8_t>;
136  break;
137  case DataType::F16:
138  _func = &depth_concat<uint16_t>;
139  break;
140  case DataType::F32:
141  _func = &depth_concat<uint32_t>;
142  break;
143  default:
144  ARM_COMPUTE_ERROR("Unsupported data type.");
145  }
146 
147  // Configure kernel window
148  auto win_config = validate_and_configure_window(input->info(), depth_offset, output->info());
149  ARM_COMPUTE_ERROR_THROW_ON(std::get<0>(win_config));
150 
151  INEKernel::configure(std::get<1>(win_config));
152 
153  // Set output valid region
154  output->info()->set_valid_region(ValidRegion(Coordinates(), output->info()->tensor_shape()));
155 }
#define ARM_COMPUTE_ERROR(...)
Print the given message then throw an std::runtime_error.
Definition: Error.h:261
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)
virtual DataType data_type() const =0
Data type used for each element of the tensor.
1 channel, 1 F32 per channel
#define ARM_COMPUTE_ERROR_THROW_ON(status)
Definition: Error.h:327
virtual void set_valid_region(const ValidRegion &valid_region)=0
Set the valid region of the tensor.
1 channel, 1 F16 per channel
virtual const TensorShape & tensor_shape() const =0
Size for each dimension of the tensor.
quantized, asymmetric fixed-point 8-bit number
Coordinates of an item.
Definition: Coordinates.h:37
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Definition: Validate.h:161
Container for valid region of a window.
Definition: Types.h:174

References ARM_COMPUTE_ERROR, ARM_COMPUTE_ERROR_ON_NULLPTR, ARM_COMPUTE_ERROR_THROW_ON, ITensorInfo::data_type(), arm_compute::F16, arm_compute::F32, ITensor::info(), arm_compute::QASYMM8, ITensorInfo::set_valid_region(), ITensorInfo::tensor_shape(), 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 40 of file NEDepthConcatenateLayerKernel.h.

41  {
42  return "NEDepthConcatenateLayerKernel";
43  }

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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 166 of file NEDepthConcatenateLayerKernel.cpp.

167 {
171  ARM_COMPUTE_ERROR_ON(_func == nullptr);
172 
173  (*_func)(_input, _output, _depth_offset, window);
174 }
const Window & window() const
The maximum window the kernel can be executed on.
Definition: IKernel.cpp:28
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:337
#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, 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 input,
unsigned int  depth_offset,
const ITensorInfo output 
)
static

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

Parameters
[in]inputInput tensor info. Data types supported: QASYMM8/F16/F32.
[in]depth_offsetThe offset on the Z axis.
[in]outputOutput tensor info. Data types supported: Same as input.
Returns
a status

Definition at line 157 of file NEDepthConcatenateLayerKernel.cpp.

160 {
161  ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(input, depth_offset, output));
162  ARM_COMPUTE_RETURN_ON_ERROR(validate_and_configure_window(input->clone().get(), depth_offset, output->clone().get()).first);
163  return Status{};
164 }
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
Status class.
Definition: Error.h:52
virtual std::unique_ptr< T > clone() const =0
Provide a clone of the current object of class T.

References ARM_COMPUTE_RETURN_ON_ERROR, ICloneable< T >::clone(), and arm_compute::validate_and_configure_window().


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