| 1 | |
| 2 | static 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 | |
| 26 | static int ref_conv_fp16(const __fp16* input, __fp16* output, const __fp16* kernel, const __fp16* bias, op_data* param) |
| 27 | { |
no test coverage detected