blob: e2e50f464f28f2d256a5eb985fef2e1d5579f337 [file] [log] [blame]
Georgios Pinitas284cfe22018-02-13 12:15:13 +00001/*
Georgios Pinitas0f7ef8a2021-01-10 04:23:52 +00002 * Copyright (c) 2018-2021 Arm Limited.
Georgios Pinitas284cfe22018-02-13 12:15:13 +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 */
Michalis Spyrouf4643372019-11-29 16:17:13 +000024#ifndef ARM_COMPUTE_NEPERMUTE_H
25#define ARM_COMPUTE_NEPERMUTE_H
Georgios Pinitas284cfe22018-02-13 12:15:13 +000026
Georgios Pinitas0f7ef8a2021-01-10 04:23:52 +000027#include "arm_compute/runtime/IFunction.h"
Georgios Pinitas284cfe22018-02-13 12:15:13 +000028
29#include "arm_compute/core/Types.h"
30
Georgios Pinitas0f7ef8a2021-01-10 04:23:52 +000031#include <memory>
32
Georgios Pinitas284cfe22018-02-13 12:15:13 +000033namespace arm_compute
34{
Georgios Pinitas33843562019-12-10 13:33:18 +000035// Forward declarations
Georgios Pinitas284cfe22018-02-13 12:15:13 +000036class ITensor;
Michalis Spyrouebcebf12020-10-21 00:04:14 +010037class ITensorInfo;
Georgios Pinitas284cfe22018-02-13 12:15:13 +000038
Michele Di Giorgiobd2c8e12021-01-19 15:29:02 +000039/** Basic function to run @ref cpu::kernels::CpuPermuteKernel */
Georgios Pinitas0f7ef8a2021-01-10 04:23:52 +000040class NEPermute : public IFunction
Georgios Pinitas284cfe22018-02-13 12:15:13 +000041{
42public:
Georgios Pinitas0f7ef8a2021-01-10 04:23:52 +000043 /** Default Constructor */
44 NEPermute();
45 /** Default Destructor */
46 ~NEPermute();
47 /** Prevent instances of this class from being copied (As this class contains pointers) */
48 NEPermute(const NEPermute &) = delete;
49 /** Default move constructor */
50 NEPermute(NEPermute &&);
51 /** Prevent instances of this class from being copied (As this class contains pointers) */
52 NEPermute &operator=(const NEPermute &) = delete;
53 /** Default move assignment operator */
54 NEPermute &operator=(NEPermute &&);
Georgios Pinitas284cfe22018-02-13 12:15:13 +000055 /** Configure the permute NEON kernel
56 *
Georgios Pinitascc4815f2019-12-04 18:02:41 +000057 * @note Arbitrary permutation vectors are supported with rank not greater than 4
Georgios Pinitas284cfe22018-02-13 12:15:13 +000058 *
Georgios Pinitas33843562019-12-10 13:33:18 +000059 * @param[in] input The input tensor to permute. Data types supported: All
Georgios Pinitas284cfe22018-02-13 12:15:13 +000060 * @param[out] output The output tensor. Data types supported: Same as @p input
61 * @param[in] perm Permutation vector
62 */
63 void configure(const ITensor *input, ITensor *output, const PermutationVector &perm);
64 /** Static function to check if given info will lead to a valid configuration of @ref NEPermute
65 *
Georgios Pinitascc4815f2019-12-04 18:02:41 +000066 * @note Arbitrary permutation vectors are supported with rank not greater than 4
Georgios Pinitas284cfe22018-02-13 12:15:13 +000067 *
Georgios Pinitas33843562019-12-10 13:33:18 +000068 * @param[in] input The input tensor to permute. Data types supported: All
Georgios Pinitas284cfe22018-02-13 12:15:13 +000069 * @param[in] output The output tensor. Data types supported: Same as @p input
70 * @param[in] perm Permutation vector
71 *
72 * @return a status
73 */
74 static Status validate(const ITensorInfo *input, const ITensorInfo *output, const PermutationVector &perm);
Georgios Pinitas0f7ef8a2021-01-10 04:23:52 +000075
76 // Inherited methods overridden
77 void run() override;
78
79private:
80 struct Impl;
81 std::unique_ptr<Impl> _impl;
Georgios Pinitas284cfe22018-02-13 12:15:13 +000082};
Michalis Spyrou95abfdd2018-11-28 14:59:47 +000083} // namespace arm_compute
Michalis Spyrouf4643372019-11-29 16:17:13 +000084#endif /* ARM_COMPUTE_NEPERMUTE_H */