ONE - On-device Neural Engine
Loading...
Searching...
No Matches
ReLU6.cpp
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
#include "
NodeExecution.h
"
18
19
namespace
20
{
21
22
inline
float
relu6_ew(
float
val) {
return
val < 0.0f ? 0.0f : (val < 6.0f ? val : 6.0f); }
23
24
}
// namespace
25
26
namespace
locomotiv
27
{
28
29
void
NodeExecution::execute(
loco::ReLU6
*relu6)
30
{
31
struct
Func final :
public
UnaryFunc
32
{
33
float
apply
(
float
v)
const
final
{
return
relu6_ew(v); }
34
};
35
36
Func f;
37
38
eltwise_unary(relu6, f);
39
}
40
41
}
// namespace locomotiv
NodeExecution.h
loco::ReLU6
Create a new value that rectifies its input capping the units at 6.
Definition
Nodes.h:172
loco::apply
ShapeInferenceSession apply(ShapeInferenceRule *r)
Definition
ShapeInference.h:51
locomotiv
Definition
NodeData.h:27
compiler
locomotiv
src
Node
ReLU6.cpp
Generated by
1.9.8