Commit ecc09651 authored by Xuewei Meng's avatar Xuewei Meng Committed by Steven Liu

libavfilter/dnn_native: Add multiple activation functions in dnn native

Add "Leaky_relu" and "None" option in activation function.
Reviewed-by: 's avatarGuo, Yejun <yejun.guo@intel.com>
Signed-off-by: 's avatarXuewei Meng <xwmeng96@gmail.com>
Signed-off-by: 's avatarSteven Liu <lq@onvideo.cn>
parent e45e6005
......@@ -270,6 +270,11 @@ static void convolve(const float *input, float *output, const ConvolutionalParam
break;
case SIGMOID:
output[n_filter] = 1.0f / (1.0f + exp(-output[n_filter]));
break;
case NONE:
break;
case LEAKY_RELU:
output[n_filter] = FFMAX(output[n_filter], 0.0) + 0.2 * FFMIN(output[n_filter], 0.0);
}
}
output += conv_params->output_num;
......
......@@ -32,7 +32,7 @@
typedef enum {INPUT, CONV, DEPTH_TO_SPACE} DNNLayerType;
typedef enum {RELU, TANH, SIGMOID} DNNActivationFunc;
typedef enum {RELU, TANH, SIGMOID, NONE, LEAKY_RELU} DNNActivationFunc;
typedef enum {VALID, SAME, SAME_CLAMP_TO_EDGE} DNNConvPaddingParam;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment