Debian Codegraph @

arm_compute/runtime/experimental/operators/CpuTranspose.h

raw
1 /*
2 * Copyright (c) 2024 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
25 #ifndef ACL_ARM_COMPUTE_RUNTIME_EXPERIMENTAL_OPERATORS_CPUTRANSPOSE_H
26 #define ACL_ARM_COMPUTE_RUNTIME_EXPERIMENTAL_OPERATORS_CPUTRANSPOSE_H
27
28 #include "arm_compute/core/ITensorPack.h"
29 #include "arm_compute/core/TensorInfo.h"
30 #include "arm_compute/runtime/NEON/INEOperator.h"
31
32 namespace arm_compute
33 {
34 namespace experimental
35 {
36 namespace op
37 {
38 /** Wrapper class for CpuTranspose. For information on the functions,
39 * see "src/cpu/operators/CpuTranspose.h"
40 */
41 class CpuTranspose : public INEOperator
42 {
43 public:
44 /** Constructor **/
45 CpuTranspose();
46 /** Prevent instances of this class from being copied (As this class contains pointers) */
47 CpuTranspose(const CpuTranspose &) = delete;
48 /** Prevent copy assignment */
49 CpuTranspose &operator=(const CpuTranspose &) = delete;
50 /** Default move constructor */
51 CpuTranspose(CpuTranspose &&) = default;
52 /** Default move assignment */
53 CpuTranspose &operator=(CpuTranspose &&) = default;
54 /** Default destructor */
55 ~CpuTranspose() override;
56
57 /** Configure kernel for a given list of arguments
58 *
59 * @param[in] src Source tensor to permute. Data types supported: All
60 * @param[out] dst Destination tensor. Data types supported: Same as @p src
61 */
62 void configure(const ITensorInfo *src, ITensorInfo *dst);
63 /** Static function to check if given info will lead to a valid configuration
64 *
65 * Similar to CpuTransposeKernel::configure()
66 *
67 * @return a status
68 */
69 static Status validate(const ITensorInfo *src, const ITensorInfo *dst);
70
71 void run(ITensorPack &tensors) override;
72
73 private:
74 struct Impl;
75 std::unique_ptr<Impl> _impl;
76 };
77 } // namespace op
78 } // namespace experimental
79 } // namespace arm_compute
80
81 #endif // ACL_ARM_COMPUTE_RUNTIME_EXPERIMENTAL_OPERATORS_CPUTRANSPOSE_H