MCPcopy Create free account
hub / github.com/OAID/Tengine / activation_fp16

Function activation_fp16

executor/operator/ref/kernel/convolution/ref_conv_fp16.c:2–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1
2static inline void activation_fp16(__fp16* input, int activation)
3{
4#if !defined(__ARM_ARCH) || __ARM_ARCH < 8
5 float tmp = fp16_to_fp32(*input);
6#else
7 __fp16 tmp = *input;
8#endif
9 if(activation >= 0)
10 {
11 if(tmp < 0)
12 tmp = 0;
13 if(activation == 1 && tmp > 1)
14 tmp = 1;
15 if(activation == 2 && tmp > 6)
16 tmp = 6;
17 }
18
19#if !defined(__ARM_ARCH) || __ARM_ARCH < 8
20 *input = fp32_to_fp16(tmp);
21#else
22 *input = tmp;
23#endif
24}
25
26static int ref_conv_fp16(const __fp16* input, __fp16* output, const __fp16* kernel, const __fp16* bias, op_data* param)
27{

Callers 1

ref_conv_fp16Function · 0.70

Calls 2

fp16_to_fp32Function · 0.85
fp32_to_fp16Function · 0.85

Tested by

no test coverage detected