diff mbox series

[FFmpeg-devel,v1,libavfiler/dnn] :[To improve efficiency, the exponential operation is changed to single precision]

Message ID 20211130140248.17767-1-zqhy_0929@163.com
State New
Headers show
Series [FFmpeg-devel,v1,libavfiler/dnn] :[To improve efficiency, the exponential operation is changed to single precision] | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Qiang.Zhang Nov. 30, 2021, 2:02 p.m. UTC
Signed-off-by: Qiang.Zhang <zqhy_0929@163.com>
---
 libavfilter/dnn/dnn_backend_native_layer_conv2d.c | 4 ++--
 libavfilter/dnn/dnn_backend_native_layer_dense.c  | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
index 7a60aa6a4b..6bf4080a68 100644
--- a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
+++ b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
@@ -166,10 +166,10 @@  static void * dnn_execute_layer_conv2d_thread(void *threadarg)
                     output[n_filter] = FFMAX(output[n_filter], 0.0);
                     break;
                 case TANH:
-                    output[n_filter] = 2.0f  / (1.0f + exp(-2.0f * output[n_filter])) - 1.0f;
+                    output[n_filter] = 2.0f  / (1.0f + expf(-2.0f * output[n_filter])) - 1.0f;
                     break;
                 case SIGMOID:
-                    output[n_filter] = 1.0f / (1.0f + exp(-output[n_filter]));
+                    output[n_filter] = 1.0f / (1.0f + expf(-output[n_filter]));
                     break;
                 case NONE:
                     break;
diff --git a/libavfilter/dnn/dnn_backend_native_layer_dense.c b/libavfilter/dnn/dnn_backend_native_layer_dense.c
index 117590d7bb..274d9150ec 100644
--- a/libavfilter/dnn/dnn_backend_native_layer_dense.c
+++ b/libavfilter/dnn/dnn_backend_native_layer_dense.c
@@ -133,10 +133,10 @@  int ff_dnn_execute_layer_dense(DnnOperand *operands, const int32_t *input_operan
                     output[n_filter] = FFMAX(output[n_filter], 0.0);
                     break;
                 case TANH:
-                    output[n_filter] = 2.0f  / (1.0f + exp(-2.0f * output[n_filter])) - 1.0f;
+                    output[n_filter] = 2.0f  / (1.0f + expf(-2.0f * output[n_filter])) - 1.0f;
                     break;
                 case SIGMOID:
-                    output[n_filter] = 1.0f / (1.0f + exp(-output[n_filter]));
+                    output[n_filter] = 1.0f / (1.0f + expf(-output[n_filter]));
                     break;
                 case NONE:
                     break;