[FFmpeg-devel] [PATCH V2 12/12] dnn-layer-math-unary-test: add unit test for atanh

Ting Fu ting.fu at intel.com
Mon Jun 29 17:54:11 EEST 2020


Signed-off-by: Ting Fu <ting.fu at intel.com>
---
 tests/dnn/dnn-layer-mathunary-test.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/tests/dnn/dnn-layer-mathunary-test.c b/tests/dnn/dnn-layer-mathunary-test.c
index 5587e47ad5..683e623d95 100644
--- a/tests/dnn/dnn-layer-mathunary-test.c
+++ b/tests/dnn/dnn-layer-mathunary-test.c
@@ -54,6 +54,8 @@ static float get_expected(float f, DNNMathUnaryOperation op)
         return asinh(f);
     case DMUO_ACOSH:
         return acosh(f);
+    case DMUO_ATANH:
+        return atanh(f);
     default:
         av_assert0(!"not supported yet");
         return 0.f;
@@ -65,8 +67,8 @@ static int test(DNNMathUnaryOperation op)
     DnnLayerMathUnaryParams params;
     DnnOperand operands[2];
     int32_t input_indexes[1];
-    float input[1*1*2*3] = {
-        -3, 2.5, 2, -2.1, 7.8, 100};
+    float input[1*1*3*3] = {
+        0.1, 0.5, 0.75, -3, 2.5, 2, -2.1, 7.8, 100};
     float *output;
 
     params.un_op = op;
@@ -74,7 +76,7 @@ static int test(DNNMathUnaryOperation op)
     operands[0].data = input;
     operands[0].dims[0] = 1;
     operands[0].dims[1] = 1;
-    operands[0].dims[2] = 2;
+    operands[0].dims[2] = 3;
     operands[0].dims[3] = 3;
     operands[1].data = NULL;
 
@@ -121,5 +123,7 @@ int main(int agrc, char **argv)
         return 1;
     if (test(DMUO_ACOSH))
         return 1;
+    if (test(DMUO_ATANH))
+        return 1;
     return 0;
 }
-- 
2.17.1



More information about the ffmpeg-devel mailing list