56 _num_inputs = src_vector.size();
59 std::vector<const ITensorInfo *> const_src_vector(src_vector.size());
60 std::transform(src_vector.begin(), src_vector.end(), const_src_vector.begin(), [](
ITensorInfo *
t)
80 auto kernel = std::make_unique<kernels::ClWidthConcatenate2TensorsKernel>();
81 kernel->configure(compile_context, src_vector.at(0), src_vector.at(1),
dst);
82 _concat_kernels.emplace_back(std::move(kernel));
88 auto kernel = std::make_unique<kernels::ClWidthConcatenate4TensorsKernel>();
89 kernel->configure(compile_context, src_vector.at(0), src_vector.at(1), src_vector.at(2), src_vector.at(3),
dst);
90 _concat_kernels.emplace_back(std::move(kernel));
96 for(
unsigned int i = 0; i < _num_inputs; ++i)
98 auto kernel = std::make_unique<kernels::ClWidthConcatenateKernel>();
99 kernel->configure(compile_context, src_vector.at(i),
offset,
dst);
100 offset += src_vector.at(i)->dimension(_axis);
101 _concat_kernels.emplace_back(std::move(kernel));
110 for(
unsigned int i = 0; i < _num_inputs; ++i)
112 auto kernel = std::make_unique<kernels::ClHeightConcatenateKernel>();
113 kernel->configure(compile_context, src_vector.at(i),
offset,
dst);
114 offset += src_vector.at(i)->dimension(_axis);
115 _concat_kernels.emplace_back(std::move(kernel));
121 for(
unsigned int i = 0; i < _num_inputs; ++i)
123 auto kernel = std::make_unique<kernels::ClDepthConcatenateKernel>();
124 kernel->configure(compile_context, src_vector.at(i),
offset,
dst);
125 offset += src_vector.at(i)->dimension(_axis);
126 _concat_kernels.emplace_back(std::move(kernel));
132 for(
unsigned int i = 0; i < _num_inputs; ++i)
134 auto kernel = std::make_unique<kernels::ClBatchConcatenateKernel>();
135 kernel->configure(compile_context, src_vector.at(i),
offset,
dst);
136 offset += src_vector.at(i)->dimension(_axis);
137 _concat_kernels.emplace_back(std::move(kernel));
149 const unsigned int num_inputs = src_vector.size();
173 for(
const auto &
src : src_vector)
185 for(
const auto &
src : src_vector)
194 for(
const auto &
src : src_vector)
203 for(
const auto &
src : src_vector)
214 if(
dst->total_size() != 0)
230 if(static_cast<int>(tensors.
size()) - 1 != static_cast<int>(_num_inputs))
235 if(_axis ==
Window::DimX && (_num_inputs == 2 || _num_inputs == 4))
243 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.
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 ClDepthConcatenateKernel...
static CLScheduler & get()
Access the scheduler singleton.
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.
ClConcatenate()
Default constructor.
#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.
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 ClBatchConcatenateKernel...
#define ARM_COMPUTE_ERROR_THROW_ON(status)
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 ClWidthConcatenateKernel...
#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(...)
Interface to enqueue OpenCL kernels and get/set the OpenCL CommandQueue and ICLTuner.
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.
static Status validate(const ITensorInfo *src1, const ITensorInfo *src2, const ITensorInfo *src3, const ITensorInfo *src4, const ITensorInfo *dst)
Static function to check if given info will lead to a valid configuration of ClWidthConcatenate4Tenso...
void run(ITensorPack &tensors) override
Run the kernels contained in the function.
void enqueue_op(ICLKernel &kernel, ITensorPack &tensors, bool flush=true)
Schedule the execution of the passed kernel if possible.
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...
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 constexpr size_t DimZ
Alias for dimension 2 also known as Z dimension.
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 ClHeightConcatenateKerne...
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
void configure(const ClCompileContext &compile_context, const std::vector< ITensorInfo * > &src_vector, ITensorInfo *dst, size_t axis)
Initialise the kernel's inputs vector and dst.
static Status validate(const ITensorInfo *src1, const ITensorInfo *src2, const ITensorInfo *dst)
Static function to check if given info will lead to a valid configuration of ClWidthConcatenate2Tenso...
static Status validate(const std::vector< const ITensorInfo * > &src_vector, const ITensorInfo *dst, size_t axis)
Static function to check if given info will lead to a valid configuration of ClConcatenate.
Describe a multidimensional execution window.
void add_tensor(int id, ITensor *tensor)
Add tensor to the pack.