Imported Upstream version 1.7.0
[platform/core/ml/nnfw.git] / compiler / luci / lang / include / luci / IR / Nodes / CircleDepthwiseConv2D.h
1 /*
2  * Copyright (c) 2020 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 #ifndef __LUCI_IR_CIRCLEDEPTHWISECONV2D_H__
18 #define __LUCI_IR_CIRCLEDEPTHWISECONV2D_H__
19
20 #include "luci/IR/CircleNodeDecl.h"
21 #include "luci/IR/CircleOpcode.h"
22
23 #include "luci/IR/AttrDilation.h"
24 #include "luci/IR/AttrFilter.h"
25 #include "luci/IR/AttrPadding.h"
26 #include "luci/IR/AttrStride.h"
27 #include "luci/IR/AttrFusedActFunc.h"
28 #include "luci/IR/LuciNodeMixins.h"
29
30 namespace luci
31 {
32
33 /**
34  * @brief DEPTHWISE_CONV_2D in Circle
35  */
36 class CircleDepthwiseConv2D final
37     : public FixedArityNode<3, CircleNodeImpl<CircleOpcode::DEPTHWISE_CONV_2D>>,
38       public LuciNodeMixin<LuciNodeTrait::FusedActFunc>,
39       public LuciNodeMixin<LuciNodeTrait::Bias>
40 {
41 public:
42   loco::Node *input(void) const { return at(0)->node(); }
43   void input(loco::Node *node) { at(0)->node(node); }
44
45   loco::Node *filter(void) const { return at(1)->node(); }
46   void filter(loco::Node *node) { at(1)->node(node); }
47
48   loco::Node *bias(void) const override { return at(2)->node(); }
49   void bias(loco::Node *node) override { at(2)->node(node); }
50
51 public:
52   Padding padding() const { return _padding; }
53   void padding(Padding padding) { _padding = padding; }
54
55   const Stride *stride(void) const { return &_stride; }
56   Stride *stride(void) { return &_stride; }
57
58   int32_t depthMultiplier(void) const { return _depth_multiplier; }
59   void depthMultiplier(int32_t arg) { _depth_multiplier = arg; }
60
61   const Dilation *dilation(void) const { return &_dilation; }
62   Dilation *dilation(void) { return &_dilation; }
63
64 private:
65   Padding _padding = Padding::UNDEFINED;
66   Stride _stride;
67   int32_t _depth_multiplier = 0;
68   Dilation _dilation;
69 };
70
71 } // namespace luci
72
73 #endif // __LUCI_IR_CIRCLEDEPTHWISECONV2D_H__