Imported Upstream version 1.4.0
[platform/core/ml/nnfw.git] / runtime / contrib / pure_arm_compute / src / internal / op / Div.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    Div.h
19  * @ingroup COM_AI_RUNTIME
20  * @brief   This file defines internal::tflite::op::Div::Param struct
21  *          and internal::tflite::op::Div::Node class
22  */
23 #ifndef __INTERNAL_OP_DIV_H__
24 #define __INTERNAL_OP_DIV_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 Div
37 {
38
39 /**
40  * @brief Struct to have indexes for operation parameter
41  */
42 struct Param
43 {
44   int32_t ofm_index; /**< Index of output feature map */
45
46   int32_t lhs_index;        /**< Index of lhs */
47   int32_t rhs_index;        /**< Index of rhs */
48   int32_t activation_index; /**< Index of activation */
49   /**
50    * @brief Construct as default
51    */
52   Param() = default;
53   /**
54    * @brief Construct a new Param object with params
55    * @param[in] inputCount  Count of inputs
56    * @param[in] inputs      Pointer of inputs
57    * @param[in] outputCount Count of outputs
58    * @param[in] outputs     Pointer of outputs
59    */
60   Param(uint32_t inputCount, const uint32_t *inputs, uint32_t outputCount, const uint32_t *outputs);
61 };
62
63 /**
64  * @brief Class to represent an operation of data structure
65  */
66 class Node final : public op::Node
67 {
68 public:
69   /**
70    * @brief Construct a new Node object with param
71    * @param[in] param Param object that makes up a Node
72    */
73   Node(const Param &param) : _param(param)
74   {
75     // DO NOTHING
76   }
77
78 public:
79   /**
80    * @brief Destruct as default
81    */
82   virtual ~Node() = default;
83
84 public:
85   /**
86    * @brief  Get a reference of Param object
87    * @return Reference of Param object
88    */
89   const Param &param(void) const { return _param; }
90
91 public:
92   /**
93    * @brief Visit this Node by NodeVisitor
94    * @param[in] v Visitor
95    * @return N/A
96    */
97   void accept(NodeVisitor &&) const override;
98
99 private:
100   const Param _param;
101 };
102
103 } // namespace Div
104 } // namespace op
105 } // namespace tflite
106 } // namespace internal
107
108 #endif // __INTERNAL_OP_DIV_H__