49 _num_inputs = src_vector.size();
52 std::vector<const ITensorInfo *> const_src_vector(src_vector.size());
53 std::transform(src_vector.begin(), src_vector.end(), const_src_vector.begin(), [](
ITensorInfo *
t)
73 auto kernel = std::make_unique<kernels::ClWidthConcatenate2TensorsKernel>();
74 kernel->configure(compile_context, src_vector.at(0), src_vector.at(1),
dst);
75 _concat_kernels.emplace_back(std::move(kernel));
81 auto kernel = std::make_unique<kernels::ClWidthConcatenate4TensorsKernel>();
82 kernel->configure(compile_context, src_vector.at(0), src_vector.at(1), src_vector.at(2), src_vector.at(3),
dst);
83 _concat_kernels.emplace_back(std::move(kernel));
89 for(
unsigned int i = 0; i < _num_inputs; ++i)
91 auto kernel = std::make_unique<kernels::ClWidthConcatenateKernel>();
92 kernel->configure(compile_context, src_vector.at(i),
offset,
dst);
93 offset += src_vector.at(i)->dimension(_axis);
94 _concat_kernels.emplace_back(std::move(kernel));
103 for(
unsigned int i = 0; i < _num_inputs; ++i)
105 auto kernel = std::make_unique<kernels::ClHeightConcatenateKernel>();
106 kernel->configure(compile_context, src_vector.at(i),
offset,
dst);
107 offset += src_vector.at(i)->dimension(_axis);
108 _concat_kernels.emplace_back(std::move(kernel));
114 for(
unsigned int i = 0; i < _num_inputs; ++i)
116 auto kernel = std::make_unique<kernels::ClDepthConcatenateKernel>();
117 kernel->configure(compile_context, src_vector.at(i),
offset,
dst);
118 offset += src_vector.at(i)->dimension(_axis);
119 _concat_kernels.emplace_back(std::move(kernel));
125 for(
unsigned int i = 0; i < _num_inputs; ++i)
127 auto kernel = std::make_unique<kernels::ClBatchConcatenateKernel>();
128 kernel->configure(compile_context, src_vector.at(i),
offset,
dst);
129 offset += src_vector.at(i)->dimension(_axis);
130 _concat_kernels.emplace_back(std::move(kernel));
142 const unsigned int num_inputs = src_vector.size();
166 for(
const auto &
src : src_vector)
170 offset +=
src->dimension(axis);
178 for(
const auto &
src : src_vector)
181 offset +=
src->dimension(axis);
187 for(
const auto &
src : src_vector)
190 offset +=
src->dimension(axis);
196 for(
const auto &
src : src_vector)
199 offset +=
src->dimension(axis);
223 if(static_cast<int>(tensors.
size()) - 1 != static_cast<int>(_num_inputs))
228 if(_axis ==
Window::DimX && (_num_inputs == 2 || _num_inputs == 4))
236 for(
auto &k : _concat_kernels)
__global uchar * offset(const Image *img, int x, int y)
Get the pointer position of a Image.
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.
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.
#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.
#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.
#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.
void run(ITensorPack &tensors) override
Run the kernels contained in the function.
virtual const TensorShape & tensor_shape() const =0
Size for each dimension of the tensor.
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.
virtual size_t total_size() const =0
Returns the total size of the tensor in bytes.
static constexpr size_t DimZ
Alias for dimension 2 also known as Z dimension.
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.
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.
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
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.
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...
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.
void add_tensor(int id, ITensor *tensor)
Add tensor to the pack.