From patchwork Thu Jul 2 13:51:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Fu, Ting" X-Patchwork-Id: 20774 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 88EA844B4F5 for ; Thu, 2 Jul 2020 16:57:14 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 66FE068A953; Thu, 2 Jul 2020 16:57:14 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C0CCF6881C4 for ; Thu, 2 Jul 2020 16:57:07 +0300 (EEST) IronPort-SDR: Dz26OhhlViS+wTs1lrLP7OwEqQ5onBO0iRzgtV5W7M8OOToqV4Aypm1t4i9oqfy80yb04HBZ/r /JZiMBrxHoEA== X-IronPort-AV: E=McAfee;i="6000,8403,9669"; a="146897622" X-IronPort-AV: E=Sophos;i="5.75,304,1589266800"; d="scan'208";a="146897622" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jul 2020 06:57:05 -0700 IronPort-SDR: WP/YDdGAl3Zs68+ldg69qWvcDNgyOdzUeLcuNDI3qAv0EyFXgVKoOUNWTttUffzChXyyyyj+CE k6XIBK5w/q+g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,304,1589266800"; d="scan'208";a="304253049" Received: from semmer-ubuntu.sh.intel.com ([10.239.159.54]) by fmsmga004.fm.intel.com with ESMTP; 02 Jul 2020 06:57:04 -0700 From: Ting Fu To: ffmpeg-devel@ffmpeg.org Date: Thu, 2 Jul 2020 21:51:24 +0800 Message-Id: <20200702135124.2751-1-ting.fu@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [FFmpeg-devel] [PATCH] tests/dnn/mathunary: fix the issue of NAN X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" When one of output[i] & expected_output is NAN, the unit test will always pass. Signed-off-by: Ting Fu --- tests/dnn/dnn-layer-mathunary-test.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/dnn/dnn-layer-mathunary-test.c b/tests/dnn/dnn-layer-mathunary-test.c index bf77c44bbe..f251447771 100644 --- a/tests/dnn/dnn-layer-mathunary-test.c +++ b/tests/dnn/dnn-layer-mathunary-test.c @@ -74,7 +74,8 @@ 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) { + if ((isnan(output[i]) ^ isnan(expected_output)) || + fabs(output[i] - expected_output) > EPS) { printf("at index %d, output: %f, expected_output: %f\n", i, output[i], expected_output); av_freep(&output); return 1;