Imported Upstream version 1.4.0
[platform/core/ml/nnfw.git] / runtime / contrib / pure_arm_compute / src / internal / op / Tanh.h
1 /*
2  * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *    http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 /**
18  * @file Tanh.h
19  * @ingroup COM_AI_RUNTIME
20  * @brief This file defines TANH node
21  */
22
23 #ifndef __INTERNAL_OP_TANH_H__
24 #define __INTERNAL_OP_TANH_H__
25
26 #include "internal/op/Node.h"
27
28 #include <cstdint>
29
30 namespace internal
31 {
32 namespace tflite
33 {
34 namespace op
35 {
36 namespace Tanh
37 {
38
39 /**
40  * @brief Struct to manipulate parameter for hyperbolic tangent operation
41  */
42 struct Param
43 {
44   int32_t ofm_index; //!< index for output feature map
45
46   int32_t ifm_index; //!< index for input feature map
47
48   /**
49    * @brief Default Constructor
50    */
51   Param() = default;
52   /**
53    * @brief Construct a new Param object
54    * @param[in] inputCount the number of inputs
55    * @param[in] inputs pointer for input data
56    * @param[in] outputCount the number of outputs
57    * @param[in] outputs pointer for input data
58    */
59   Param(uint32_t inputCount, const uint32_t *inputs, uint32_t outputCount, const uint32_t *outputs);
60 };
61
62 /**
63  * @brief Class to define Tanh Operation
64  */
65 class Node final : public op::Node
66 {
67 public:
68   /**
69    * @brief Construct a new Tanh Node object
70    * @param param Parameter for Tanh Node
71    */
72   Node(const Param &param) : _param(param)
73   {
74     // DO NOTHING
75   }
76
77 public:
78   /**
79    * @brief Default Destructor
80    */
81   virtual ~Node() = default;
82
83 public:
84   /**
85    * @brief Get parameter
86    * @return Param reference
87    */
88   const Param &param(void) const { return _param; }
89
90 public:
91   /**
92    * @brief Accept a NodeVisitor so that it can visit this node
93    * @param [in] v Visitor
94    * @return N/A
95    */
96   void accept(NodeVisitor &&) const override;
97
98 private:
99   const Param _param; //!< parameter for Tanh node
100 };
101
102 } // namespace Tanh
103 } // namespace op
104 } // namespace tflite
105 } // namespace internal
106
107 #endif // __INTERNAL_OP_TANH_H__