Debian Codegraph @

arm_compute/runtime/experimental/operators/CpuActivation.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_CPUACTIVATION_H
26 #define ACL_ARM_COMPUTE_RUNTIME_EXPERIMENTAL_OPERATORS_CPUACTIVATION_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 CpuActivation. For information on the functions,
39 * see "src/cpu/operators/CpuActivation.h"
40 */
41 class CpuActivation : public INEOperator
42 {
43 public:
44 /** Constructor **/
45 CpuActivation();
46 /** Prevent instances of this class from being copied (As this class contains pointers) */
47 CpuActivation(const CpuActivation &) = delete;
48 /** Prevent copy assignment */
49 CpuActivation &operator=(const CpuActivation &) = delete;
50 /** Default move constructor */
51 CpuActivation(CpuActivation &&) = default;
52 /** Default move assignment */
53 CpuActivation &operator=(CpuActivation &&) = default;
54 /** Default destructor */
55 ~CpuActivation() override;
56
57 /** Configure operator for a given list of arguments
58 *
59 * @param[in] src Source tensor info. Data types supported: QASYMM8/QASYMM8_SIGNED/QSYMM16/F16/F32.
60 * @param[out] dst Destination tensor info. Data type supported: same as @p src
61 * @param[in] act_info Activation layer parameters.
62 */
63 void configure(const ITensorInfo *src, ITensorInfo *dst, const ActivationLayerInfo &act_info);
64
65 /** Static function to check if given info will lead to a valid configuration
66 *
67 * Similar to @ref CpuActivation::configure()
68 *
69 * @return a status
70 */
71 static Status validate(const ITensorInfo *src, const ITensorInfo *dst, const ActivationLayerInfo &act_info);
72
73 void run(ITensorPack &tensors) override;
74
75 private:
76 struct Impl;
77 std::unique_ptr<Impl> _impl;
78 };
79 } // namespace op
80 } // namespace experimental
81 } // namespace arm_compute
82
83 #endif // ACL_ARM_COMPUTE_RUNTIME_EXPERIMENTAL_OPERATORS_CPUACTIVATION_H