24.02.1
|
Go to the documentation of this file.
46 const std::vector<ITensorInfo *> &src_vector,
53 _num_inputs = src_vector.size();
56 std::vector<const ITensorInfo *> const_src_vector(src_vector.size());
57 std::transform(src_vector.begin(), src_vector.end(), const_src_vector.begin(),
60 ARM_COMPUTE_ERROR_ON_NULLPTR(t);
78 auto kernel = std::make_unique<kernels::ClWidthConcatenate2TensorsKernel>();
79 kernel->configure(compile_context, src_vector.at(0), src_vector.at(1),
dst);
80 _concat_kernels.emplace_back(std::move(kernel));
86 auto kernel = std::make_unique<kernels::ClWidthConcatenate4TensorsKernel>();
87 kernel->configure(compile_context, src_vector.at(0), src_vector.at(1), src_vector.at(2),
88 src_vector.at(3),
dst);
89 _concat_kernels.emplace_back(std::move(kernel));
95 for (
unsigned int i = 0; i < _num_inputs; ++i)
97 auto kernel = std::make_unique<kernels::ClWidthConcatenateKernel>();
98 kernel->configure(compile_context, src_vector.at(i),
offset,
dst);
99 offset += src_vector.at(i)->dimension(_axis);
100 _concat_kernels.emplace_back(std::move(kernel));
109 for (
unsigned int i = 0; i < _num_inputs; ++i)
111 auto kernel = std::make_unique<kernels::ClHeightConcatenateKernel>();
112 kernel->configure(compile_context, src_vector.at(i),
offset,
dst);
113 offset += src_vector.at(i)->dimension(_axis);
114 _concat_kernels.emplace_back(std::move(kernel));
120 for (
unsigned int i = 0; i < _num_inputs; ++i)
122 auto kernel = std::make_unique<kernels::ClDepthConcatenateKernel>();
123 kernel->configure(compile_context, src_vector.at(i),
offset,
dst);
124 offset += src_vector.at(i)->dimension(_axis);
125 _concat_kernels.emplace_back(std::move(kernel));
131 for (
unsigned int i = 0; i < _num_inputs; ++i)
133 auto kernel = std::make_unique<kernels::ClBatchConcatenateKernel>();
134 kernel->configure(compile_context, src_vector.at(i),
offset,
dst);
135 offset += src_vector.at(i)->dimension(_axis);
136 _concat_kernels.emplace_back(std::move(kernel));
148 const unsigned int num_inputs = src_vector.size();
170 src_vector[0], src_vector[1], src_vector[2], src_vector[3],
dst));
174 for (
const auto &
src : src_vector)
186 for (
const auto &
src : src_vector)
195 for (
const auto &
src : src_vector)
204 for (
const auto &
src : src_vector)
215 if (
dst->total_size() != 0)
231 if (
static_cast<int>(tensors.
size()) - 1 !=
static_cast<int>(_num_inputs))
236 if (_axis ==
Window::DimX && (_num_inputs == 2 || _num_inputs == 4))
244 for (
auto &k : _concat_kernels)
SimpleTensor< float > src
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 *src, unsigned int height_offset, 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.
static constexpr size_t DimX
Alias for dimension 0 also known as X dimension.
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
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 add_tensor(int id, ITensor *tensor)
Add tensor to the pack.
ITensor * get_tensor(int id)
Get tensor of a given id from the pac.
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_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
bool empty() const
Checks if pack is empty.
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
const ITensor * get_const_tensor(int id) const
Get constant tensor of a given id.
#define ARM_COMPUTE_ERROR_THROW_ON(status)
#define ARM_COMPUTE_RETURN_ERROR_ON(cond)
If the condition is true, an error is returned.
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 total_size() const
Collapses all dimensions to a single linear total size.
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.
Interface to enqueue OpenCL kernels and get/set the OpenCL CommandQueue and ICLTuner.
__global uchar * offset(const Image *img, int x, int y)
Get the pointer position of a Image.
size_t size() const
Pack size accessor.
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 constexpr size_t DimY
Alias for dimension 1 also known as Y dimension.
static CLScheduler & get()
Access the scheduler singleton.
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.
Copyright (c) 2017-2024 Arm Limited.
static constexpr size_t DimZ
Alias for dimension 2 also known as Z dimension.
#define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...)
void enqueue_op(ICLKernel &kernel, ITensorPack &tensors, bool flush=true)
Schedule the execution of the passed kernel if possible.
Store the tensor's metadata.
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.
#define ARM_COMPUTE_LOG_PARAMS(...)
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.