blob: 06686a6665c43b67d8199e3022eb15ed32ead028 [file] [log] [blame]
Georgios Pinitas6d9d6f42018-12-24 16:10:47 +00001/*
2 * Copyright (c) 2018-2019 ARM Limited.
3 *
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 */
24#ifndef __ARM_COMPUTE_NESPLIT_H__
25#define __ARM_COMPUTE_NESPLIT_H__
26
27#include "arm_compute/core/Types.h"
28
29#include "arm_compute/runtime/IFunction.h"
30#include "arm_compute/runtime/NEON/functions/NESlice.h"
31
32#include <memory>
33#include <vector>
34
35namespace arm_compute
36{
37// Forward declarations
38class ITensor;
39
40/** Basic function to split a tensor along a given axis */
41class NESplit : public IFunction
42{
43public:
44 /** Default constructor */
45 NESplit();
46 /** Initialise the kernel's input and outputs.
47 *
48 * @param[in] input The input tensor. Data types supported: U8/S8/QASYMM8/U16/S16/U32/S32/F16/F32.
49 * @param[out] outputs A vector containing the output tensors. Data types supported: Same as @p input.
50 * The output tensors should match the input tensor dimensions for all shape dimensions apart
51 * from the split dimension.
52 * @param[in] axis Axis on which to split the input.
53 */
54 void configure(const ITensor *input, const std::vector<ITensor *> &outputs, unsigned int axis);
55 /** Static function to check if given info will lead to a valid configuration of @ref NESplit
56 *
57 * @param[in] input The input tensor info. Data types supported: U8/S8/QASYMM8/U16/S16/U32/S32/F16/F32.
58 * @param[in] outputs A vector containing the output tensors' info. Data types supported: Same as @p input.
59 * The output tensors should match the input tensor dimensions for all shape dimensions apart
60 * from the split dimension
61 * @param[in] axis Axis on which to split the input.
62 *
63 * @return a status
64 */
65 static Status validate(const ITensorInfo *input, const std::vector<ITensorInfo *> &outputs, unsigned int axis);
66
67 // Inherited methods overridden:
68 void run() override;
69
70private:
Michalis Spyroubcfd09a2019-05-01 13:03:59 +010071 std::vector<ITensor *> _outputs_vector;
72 std::vector<NESlice> _slice_functions;
73 unsigned int _num_outputs;
Georgios Pinitas6d9d6f42018-12-24 16:10:47 +000074};
75} // namespace arm_compute
76#endif /* __ARM_COMPUTE_NESPLIT_H__ */