]> git.sesse.net Git - ffmpeg/commitdiff
lavfi/dnn/dnn_backend_native_layer_mathunary: add exp support
authorWenlong Ding <wenlong.ding@intel.com>
Mon, 22 Mar 2021 08:20:11 +0000 (16:20 +0800)
committerGuo, Yejun <yejun.guo@intel.com>
Wed, 24 Mar 2021 05:53:50 +0000 (13:53 +0800)
Signed-off-by: Wenlong Ding <wenlong.ding@intel.com>
libavfilter/dnn/dnn_backend_native_layer_mathunary.c
libavfilter/dnn/dnn_backend_native_layer_mathunary.h
tools/python/convert_from_tensorflow.py
tools/python/convert_header.py

index 1bb05d02a7566878b9f8f82f0ec16bbb409a3cb1..bd28ec67d1c03c097f8b7a8fc9338d7979376fa0 100644 (file)
@@ -146,6 +146,10 @@ int ff_dnn_execute_layer_math_unary(DnnOperand *operands, const int32_t *input_o
         for (int i = 0; i < dims_count; ++i)
             dst[i] = round(src[i]);
         return 0;
+    case DMUO_EXP:
+        for (int i = 0; i < dims_count; ++i)
+            dst[i] = exp(src[i]);
+        return 0;
     default:
         av_log(ctx, AV_LOG_ERROR, "Unmatch math unary operator\n");
         return DNN_ERROR;
index 2199931e6e895763fd61cfc05b4243924ff8798d..151a73200a67dd2fd8b7163e1ed06a98491006e7 100644 (file)
@@ -46,6 +46,7 @@ typedef enum {
     DMUO_CEIL = 13,
     DMUO_FLOOR = 14,
     DMUO_ROUND = 15,
+    DMUO_EXP = 16,
     DMUO_COUNT
 } DNNMathUnaryOperation;
 
index 1a5d93fbb74812f346005d32772236b50697aeab..38e64c1c941a06a31996a8fdda85cc60364811ac 100644 (file)
@@ -78,7 +78,8 @@ class TFConverter:
         self.mathbin2code = {'Sub':0, 'Add':1, 'Mul':2, 'RealDiv':3, 'Minimum':4, 'FloorMod':5}
         self.mathun2code  = {'Abs':0, 'Sin':1, 'Cos':2, 'Tan':3, 'Asin':4,
                 'Acos':5, 'Atan':6, 'Sinh':7, 'Cosh':8, 'Tanh':9, 'Asinh':10,
-                'Acosh':11, 'Atanh':12, 'Ceil':13, 'Floor':14, 'Round':15}
+                'Acosh':11, 'Atanh':12, 'Ceil':13, 'Floor':14, 'Round':15,
+                'Exp':16}
         self.mirrorpad_mode = {'CONSTANT':0, 'REFLECT':1, 'SYMMETRIC':2}
         self.name_operand_dict = {}
 
index 782a6341f9b69331ec5111d2af444868cea520c4..143f92c42eea5f6a0d8b094bb728ef1274818845 100644 (file)
@@ -23,4 +23,4 @@ str = 'FFMPEGDNNNATIVE'
 major = 1
 
 # increase minor when we don't have to re-convert the model file
-minor = 22
+minor = 23