[FFmpeg-cvslog] tests/dnn/mathunary: fix the issue of NAN
Ting Fu
git at videolan.org
Thu Jul 9 05:59:48 EEST 2020
ffmpeg | branch: master | Ting Fu <ting.fu at intel.com> | Wed Jul 8 14:09:51 2020 +0800| [dbf66b9e0edf8869da5187921b96ab3290d17eb8] | committer: Guo, Yejun
tests/dnn/mathunary: fix the issue of NAN
When one of output[i] & expected_output is NAN, the unit test will always pass.
Signed-off-by: Ting Fu <ting.fu at intel.com>
Reviewed-by: Guo, Yejun <yejun.guo at intel.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dbf66b9e0edf8869da5187921b96ab3290d17eb8
---
tests/dnn/dnn-layer-mathunary-test.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tests/dnn/dnn-layer-mathunary-test.c b/tests/dnn/dnn-layer-mathunary-test.c
index 683e623d95..5afc5c157e 100644
--- a/tests/dnn/dnn-layer-mathunary-test.c
+++ b/tests/dnn/dnn-layer-mathunary-test.c
@@ -86,7 +86,10 @@ static int test(DNNMathUnaryOperation op)
output = operands[1].data;
for (int i = 0; i < sizeof(input) / sizeof(float); ++i) {
float expected_output = get_expected(input[i], op);
- if(fabs(output[i] - expected_output) > EPS) {
+ int output_nan = isnan(output[i]);
+ int expected_nan = isnan(expected_output);
+ if ((!output_nan && !expected_nan && fabs(output[i] - expected_output) > EPS) ||
+ (output_nan && !expected_nan) || (!output_nan && expected_nan)) {
printf("at index %d, output: %f, expected_output: %f\n", i, output[i], expected_output);
av_freep(&output);
return 1;
More information about the ffmpeg-cvslog
mailing list