1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

lavfi/dnn/dnn_backend_native_layer_mathunary: add exp support

Signed-off-by: Wenlong Ding <wenlong.ding@intel.com>
This commit is contained in:
Wenlong Ding 2021-03-22 16:20:11 +08:00 committed by Guo, Yejun
parent dfad5794fb
commit b460595dd7
4 changed files with 8 additions and 2 deletions

View 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) for (int i = 0; i < dims_count; ++i)
dst[i] = round(src[i]); dst[i] = round(src[i]);
return 0; return 0;
case DMUO_EXP:
for (int i = 0; i < dims_count; ++i)
dst[i] = exp(src[i]);
return 0;
default: default:
av_log(ctx, AV_LOG_ERROR, "Unmatch math unary operator\n"); av_log(ctx, AV_LOG_ERROR, "Unmatch math unary operator\n");
return DNN_ERROR; return DNN_ERROR;

View File

@ -46,6 +46,7 @@ typedef enum {
DMUO_CEIL = 13, DMUO_CEIL = 13,
DMUO_FLOOR = 14, DMUO_FLOOR = 14,
DMUO_ROUND = 15, DMUO_ROUND = 15,
DMUO_EXP = 16,
DMUO_COUNT DMUO_COUNT
} DNNMathUnaryOperation; } DNNMathUnaryOperation;

View File

@ -78,7 +78,8 @@ class TFConverter:
self.mathbin2code = {'Sub':0, 'Add':1, 'Mul':2, 'RealDiv':3, 'Minimum':4, 'FloorMod':5} 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, self.mathun2code = {'Abs':0, 'Sin':1, 'Cos':2, 'Tan':3, 'Asin':4,
'Acos':5, 'Atan':6, 'Sinh':7, 'Cosh':8, 'Tanh':9, 'Asinh':10, '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.mirrorpad_mode = {'CONSTANT':0, 'REFLECT':1, 'SYMMETRIC':2}
self.name_operand_dict = {} self.name_operand_dict = {}

View File

@ -23,4 +23,4 @@ str = 'FFMPEGDNNNATIVE'
major = 1 major = 1
# increase minor when we don't have to re-convert the model file # increase minor when we don't have to re-convert the model file
minor = 22 minor = 23