ONE - On-device Neural Engine
Loading...
Searching...
No Matches
CircleNodes.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019 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 __LOCOEX_IR_CIRCLENODES_H__
18#define __LOCOEX_IR_CIRCLENODES_H__
19
20#include "CircleNodeDecl.h"
21#include "CircleOpcode.h"
22
23#include "FusedActFunc.h"
24#include "NodeMixins.h" // FixedArityNode
25
26#include <loco/IR/Node.h>
27
28namespace locoex
29{
30
33{
35};
36
37template <CircleNodeTrait T> class CircleNodeMixin;
38
40{
41public:
42 CircleNodeMixin() = default;
43
44public:
45 FusedActFunc fusedActivationFunction() const { return _fused_act_fun; }
46 void fusedActivationFunction(FusedActFunc fused_act_fun) { _fused_act_fun = fused_act_fun; }
47
48private:
50};
51
56 : public FixedArityNode<3, CircleNodeImpl<CircleOpcode::INSTANCE_NORM>>,
57 public CircleNodeMixin<CircleNodeTrait::FusedActFunc>
58{
59public:
61 loco::Node *input(void) const { return at(0)->node(); }
62 void input(loco::Node *node) { at(0)->node(node); }
63
64 loco::Node *gamma(void) const { return at(1)->node(); }
65 void gamma(loco::Node *node) { at(1)->node(node); }
66
67 loco::Node *beta(void) const { return at(2)->node(); }
68 void beta(loco::Node *node) { at(2)->node(node); }
69
70 float epsilon() const { return _epsilon; }
71 void epsilon(float epsilon) { _epsilon = epsilon; }
72
73private:
74 float _epsilon = 1e-05;
75};
76
77} // namespace locoex
78
79#endif // __LOCOEX_IR_CIRCLENODES_H__
Logical unit of computation.
Definition Node.h:54
Node * node(void) const
Definition Use.h:58
INSTANCE_NORM in circle.
Definition CircleNodes.h:58
void epsilon(float epsilon)
Definition CircleNodes.h:71
loco::Node * input(void) const
Definition CircleNodes.h:61
void beta(loco::Node *node)
Definition CircleNodes.h:68
loco::Node * gamma(void) const
Definition CircleNodes.h:64
loco::Node * beta(void) const
Definition CircleNodes.h:67
void input(loco::Node *node)
Definition CircleNodes.h:62
void gamma(loco::Node *node)
Definition CircleNodes.h:65
void fusedActivationFunction(FusedActFunc fused_act_fun)
Definition CircleNodes.h:46
Nodes with the fixed number of inputs.
Definition NodeMixins.h:31
CircleNodeTrait
enumeration of mixin class
Definition CircleNodes.h:33