blob: 52ea553a7d2c3459f6b1b32d6ac47ff3afd9375d [file] [log] [blame]
Georgios Pinitas61ba0692021-01-10 04:07:39 +00001/*
Giorgio Arena5ae8d802021-11-18 18:02:13 +00002 * Copyright (c) 2019-2022 Arm Limited.
Georgios Pinitas61ba0692021-01-10 04:07:39 +00003 *
4 * SPDX-License-Identifier: MIT
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
Georgios Pinitas2eb5d162021-07-02 09:01:49 +010024#ifndef ARM_COMPUTE_CPU_CONCATENATE_BATCH_KERNEL_H
25#define ARM_COMPUTE_CPU_CONCATENATE_BATCH_KERNEL_H
Georgios Pinitas61ba0692021-01-10 04:07:39 +000026
27#include "src/core/common/Macros.h"
Georgios Pinitas7891a732021-08-20 21:39:25 +010028#include "src/cpu/ICpuKernel.h"
Georgios Pinitas61ba0692021-01-10 04:07:39 +000029
30namespace arm_compute
31{
Georgios Pinitas61ba0692021-01-10 04:07:39 +000032namespace cpu
33{
34namespace kernels
35{
36/** Interface for the batch concatenate kernel.
37 * The input tensor will be concatenated into the output tensor.
38 */
Yair Schwarzbaum46d44d22022-01-12 16:38:58 +020039class CpuConcatenateBatchKernel : public ICpuKernel<CpuConcatenateBatchKernel>
Georgios Pinitas61ba0692021-01-10 04:07:39 +000040{
41public:
Georgios Pinitas2eb5d162021-07-02 09:01:49 +010042 CpuConcatenateBatchKernel() = default;
Georgios Pinitas61ba0692021-01-10 04:07:39 +000043 ARM_COMPUTE_DISALLOW_COPY_ALLOW_MOVE(CpuConcatenateBatchKernel);
44 /** Configure kernel for a given list of arguments
45 *
46 * @param[in] src Source tensor info. Data types supported: All.
47 * @param[in] batch_offset The offset on axis # 3.
48 * @param[in,out] dst Destination tensor info. Data types supported: Same as @p src.
49 */
50 void configure(const ITensorInfo *src, unsigned int batch_offset, ITensorInfo *dst);
Georgios Pinitas2eb5d162021-07-02 09:01:49 +010051 /** Static function to check if given info will lead to a valid configuration
Georgios Pinitas61ba0692021-01-10 04:07:39 +000052 *
Georgios Pinitas2eb5d162021-07-02 09:01:49 +010053 * Similar to @ref CpuConcatenateBatchKernel::configure()
Georgios Pinitas61ba0692021-01-10 04:07:39 +000054 *
55 * @return a status
56 */
57 static Status validate(const ITensorInfo *src, unsigned int batch_offset, const ITensorInfo *dst);
58
59 // Inherited methods overridden:
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010060 void run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info) override;
Georgios Pinitas61ba0692021-01-10 04:07:39 +000061 const char *name() const override;
62
63private:
64 using BatchConcatFunction = void(const ITensor *, ITensor *, unsigned int, const Window &);
65
66private:
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010067 BatchConcatFunction *_func{nullptr};
68 unsigned int _batch_offset{0};
Georgios Pinitas61ba0692021-01-10 04:07:39 +000069};
70} // namespace kernels
71} // namespace cpu
72} // namespace arm_compute
Georgios Pinitas2eb5d162021-07-02 09:01:49 +010073#endif /* ARM_COMPUTE_CPU_CONCATENATE_BATCH_KERNEL_H */