46 : _concat_kernels(), _num_srcs(0), _axis(0)
55 _num_srcs = srcs_vector.size();
65 for(
unsigned int i = 0; i < _num_srcs; ++i)
71 auto kernel = std::make_unique<kernels::CpuConcatenateWidthKernel>();
72 kernel->configure(srcs_vector.at(i),
offset,
dst);
73 _concat_kernels.emplace_back(std::move(kernel));
78 auto kernel = std::make_unique<kernels::CpuConcatenateHeightKernel>();
79 kernel->configure(srcs_vector.at(i),
offset,
dst);
80 _concat_kernels.emplace_back(std::move(kernel));
85 auto kernel = std::make_unique<kernels::CpuConcatenateDepthKernel>();
86 kernel->configure(srcs_vector.at(i),
offset,
dst);
87 _concat_kernels.emplace_back(std::move(kernel));
92 auto kernel = std::make_unique<kernels::CpuConcatenateBatchKernel>();
93 kernel->configure(srcs_vector.at(i),
offset,
dst);
94 _concat_kernels.emplace_back(std::move(kernel));
100 offset += srcs_vector.at(i)->dimension(axis);
110 for(
const auto &
src : srcs_vector)
141 if(
dst->total_size() != 0)
157 if(static_cast<int>(tensors.
size() - 1) != static_cast<int>(_num_srcs))
163 for(
auto &k : _concat_kernels)
__global uchar * offset(const Image *img, int x, int y)
Get the pointer position of a Image.
TensorShape calculate_concatenate_shape(const std::vector< T * > &input, size_t axis)
Calculate the concatenate output shape of the concatenate operation along a single axis.
bool empty() const
Checks if pack is empty.
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
virtual void schedule_op(ICPPKernel *kernel, const Hints &hints, const Window &window, ITensorPack &tensors)=0
Runs the kernel in the same thread as the caller synchronously.
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Store the tensor's metadata.
#define ARM_COMPUTE_ERROR_THROW_ON(status)
void run(ITensorPack &tensors) override
Run the kernels contained in the function.
#define ARM_COMPUTE_RETURN_ERROR_ON(cond)
If the condition is true, an error is returned.
SimpleTensor< float > src
Copyright (c) 2017-2021 Arm Limited.
#define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...)
static Status validate(const std::vector< const ITensorInfo * > &srcs_vector, const ITensorInfo *dst, size_t axis)
Static function to check if given info will lead to a valid configuration of NEConcatenateLayer.
static Status validate(const ITensorInfo *src, unsigned int width_offset, const ITensorInfo *dst)
Static function to check if given info will lead to a valid configuration of CpuConcatenateWidthKerne...
const ITensor * get_const_tensor(int id) const
Get constant tensor of a given id.
static constexpr size_t DimX
Alias for dimension 0 also known as X dimension.
size_t total_size() const
Collapses all dimensions to a single linear total size.
bool auto_init_if_empty(ITensorInfo &info, const TensorShape &shape, int num_channels, DataType data_type, QuantizationInfo quantization_info=QuantizationInfo())
Auto initialize the tensor info (shape, number of channels and data type) if the current assignment i...
CpuConcatenate()
Constructor.
void configure(const std::vector< const ITensorInfo * > &srcs_vector, ITensorInfo *dst, size_t axis)
Configure operator for a given list of arguments.
size_t size() const
Pack size accessor.
static constexpr size_t DimY
Alias for dimension 1 also known as Y dimension.
ITensor * get_tensor(int id)
Get tensor of a given id from the pac.
static Status validate(const ITensorInfo *src, unsigned int height_offset, const ITensorInfo *dst)
Static function to check if given info will lead to a valid configuration of CpuConcatenateHeightKern...
static Status validate(const ITensorInfo *src, unsigned int batch_offset, const ITensorInfo *dst)
Static function to check if given info will lead to a valid configuration of CpuConcatenateBatchKerne...
static constexpr size_t DimZ
Alias for dimension 2 also known as Z dimension.
static Status validate(const ITensorInfo *src, unsigned int depth_offset, const ITensorInfo *dst)
Static function to check if given info will lead to a valid configuration of CpuConcatenateDepthKerne...
void add_tensor(int id, ITensor *tensor)
Add tensor to the pack.
static IScheduler & get()
Access the scheduler singleton.