Debian Codegraph @

arm_compute/runtime/experimental/operators/CpuAdd.h

raw
1 /*
2 * Copyright (c) 2021-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 #ifndef ACL_ARM_COMPUTE_RUNTIME_EXPERIMENTAL_OPERATORS_CPUADD_H
25 #define ACL_ARM_COMPUTE_RUNTIME_EXPERIMENTAL_OPERATORS_CPUADD_H
26
27 #include "arm_compute/core/ITensorInfo.h"
28 #include "arm_compute/core/ITensorPack.h"
29 #include "arm_compute/runtime/NEON/INEOperator.h"
30
31 #include <memory>
32
33 namespace arm_compute
34 {
35 namespace experimental
36 {
37 namespace op
38 {
39 /** Wrapper class for CpuAdd. For information on the functions,
40 * see "src/cpu/operators/CpuAdd.h"
41 */
42 class CpuAdd : public INEOperator
43 {
44 public:
45 /** Constructor */
46 CpuAdd();
47 /** Prevent instances of this class from being copied (As this class contains pointers) */
48 CpuAdd(const CpuAdd &) = delete;
49 /** Prevent instances of this class from being copied (As this class contains pointers) */
50 CpuAdd &operator=(const CpuAdd &) = delete;
51 /** Default move constructor */
52 CpuAdd(CpuAdd &&) = default;
53 /** Default move assignment */
54 CpuAdd &operator=(CpuAdd &&) = default;
55 /** Default destructor */
56 ~CpuAdd() override;
57 /** Initialise the kernel's input, dst and border mode.
58 *
59 * Valid configurations (src0,src1) -> dst :
60 *
61 * - (U8,U8) -> U8
62 * - (S16,S16) -> S16
63 * - (S32,S32) -> S32
64 * - (F16,F16) -> F16
65 * - (F32,F32) -> F32
66 * - (QASYMM8,QASYMM8) -> QASYMM8
67 * - (QASYMM8_SIGNED,QASYMM8_SIGNED) -> QASYMM8_SIGNED
68 * - (QSYMM16,QSYMM16) -> QSYMM16
69 *
70 * @param[in] src0 First input tensor info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/F16/S32/F32
71 * @param[in] src1 Second input tensor info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/F16/S32/F32
72 * @param[out] dst The dst tensor info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/F16/S32/F32.
73 * @param[in] policy Overflow policy.
74 * @param[in] act_info (Optional) Activation layer information in case of a fused activation. Currently not supported.
75 *
76 */
77 void configure(const ITensorInfo *src0,
78 const ITensorInfo *src1,
79 ITensorInfo *dst,
80 ConvertPolicy policy,
81 const ActivationLayerInfo &act_info = ActivationLayerInfo());
82 /** Static function to check if given info will lead to a valid configuration
83 *
84 * Similar to @ref CpuAdd::configure()
85 *
86 * @return a status
87 */
88 static Status validate(const ITensorInfo *src0,
89 const ITensorInfo *src1,
90 const ITensorInfo *dst,
91 ConvertPolicy policy,
92 const ActivationLayerInfo &act_info = ActivationLayerInfo());
93
94 void run(ITensorPack &tensors) override;
95
96 private:
97 struct Impl;
98 std::unique_ptr<Impl> _impl;
99 };
100 } // namespace op
101 } // namespace experimental
102 } // namespace arm_compute
103 #endif // ACL_ARM_COMPUTE_RUNTIME_EXPERIMENTAL_OPERATORS_CPUADD_H