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