From patchwork Mon Jun 29 14:54:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Fu, Ting" X-Patchwork-Id: 20738 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:80ca:0:0:0:0:0 with SMTP id c10csp2875849ybm; Mon, 29 Jun 2020 08:00:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwkqH738kRZ0V9qOjGxTUNYv1x+rBAjk7zE21K7CPUo3dZOYb8SDEti1s58NFIfaH+iDStf X-Received: by 2002:a5d:6b08:: with SMTP id v8mr18172878wrw.2.1593442805141; Mon, 29 Jun 2020 08:00:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593442805; cv=none; d=google.com; s=arc-20160816; b=vupazSXtHO41LT/Y+sj7weWQ0AsSrz/026MA05I8lrfgtI+4hglBOvyc3IwBWI2ecy x6J4qPI15Fz1USAQ5clmXi2Pp1Fq8LIwfXsUKXjK3bbWsWgR54ht9ydevhzowUE08MPT 2PqZwsH8YHOkHoPoJSyvH8NAnxyRpYgsfPHd/mXyl9Ms7M6WbcRne/6u2raO/qO2ESmh 2fft5/dKl1bxmAgMX+frN+4pQS9vtpfcYTYzUxF15nzuJiSDrahY1Nt9mYlteEnMB743 tWNno0p2pE7E5iIL8brfCyZEyfPYBnbQd9AxUQ/0gTIhQjHRz9iYcH2g+Mk3jRHneC4R eQWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:ironport-sdr :ironport-sdr:delivered-to; bh=sag66jxvXDm7ptyFzZI0Apu9+BIb7UjWN32NfeoLEEg=; b=LAQ45WVbrvJBZAFiDfG8R+jM4nioMR1NwRjR0CMjFFmu5UdVdp8qmwvCGd8pKvBMwS GizdoO8n/Ru2KZakFigbTdmxgRB8x5Bblsy0ZgaNuyOfDW49ONMYHgSX+VCioBDSYfP+ 6hl/6zsqrJSdcFHBjaSu4nv0FyNBiGv0sYJ/BTvlT7+9CaCQz7yAeIHl+ta8NCKSeC/f r5Dq1t5Ln2LefcKviqDXvWKW/c9fWyP7X2nsfQLOJcvRK3rB9a8FdaUceTBsfICHK7xn bVUVYGPL7goOxjXedJm5iQwlR31JhF95WTsfgsTK/knQWQ7SNdlhbZo8AODX/bb2eS1H 09zA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id s11si165896wri.53.2020.06.29.08.00.04; Mon, 29 Jun 2020 08:00:05 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6EC196882CE; Mon, 29 Jun 2020 18:00:03 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 05490687FC7 for ; Mon, 29 Jun 2020 17:59:55 +0300 (EEST) IronPort-SDR: iXZFbxdB9rARbJGIHaaBVzdtuW0YRltPOq6ZhaPpKDsJlkP0TsSot2qSDDCMaNl+quP4PvgvHZ y6+y3MpCLH2g== X-IronPort-AV: E=McAfee;i="6000,8403,9666"; a="144173124" X-IronPort-AV: E=Sophos;i="5.75,295,1589266800"; d="scan'208";a="144173124" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2020 07:59:54 -0700 IronPort-SDR: hhKeK5eoVCkMYVr2X5Ris/3ESfCkBIEBGjPvctOORRXur18WgIpu9UEezSTmxxJYm9V3MU0BUI 9izjl76tlx7w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,295,1589266800"; d="scan'208";a="313069741" Received: from semmer-ubuntu.sh.intel.com ([10.239.159.54]) by fmsmga002.fm.intel.com with ESMTP; 29 Jun 2020 07:59:53 -0700 From: Ting Fu To: ffmpeg-devel@ffmpeg.org Date: Mon, 29 Jun 2020 22:54:00 +0800 Message-Id: <20200629145411.24005-1-ting.fu@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [FFmpeg-devel] [PATCH V2 01/12] dnn_backend_native_layer_mathunary: add sinh support 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" X-TUID: NOUz07jYixID Content-Length: 3915 Signed-off-by: Ting Fu --- V2: Add more test number Fix incorrect atanh unit test libavfilter/dnn/dnn_backend_native_layer_mathunary.c | 4 ++++ libavfilter/dnn/dnn_backend_native_layer_mathunary.h | 1 + tools/python/convert_from_tensorflow.py | 2 +- tools/python/convert_header.py | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/libavfilter/dnn/dnn_backend_native_layer_mathunary.c b/libavfilter/dnn/dnn_backend_native_layer_mathunary.c index 42615c43d5..2630fe07e2 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_mathunary.c +++ b/libavfilter/dnn/dnn_backend_native_layer_mathunary.c @@ -104,6 +104,10 @@ int dnn_execute_layer_math_unary(DnnOperand *operands, const int32_t *input_oper for (int i = 0; i < dims_count; ++i) dst[i] = atan(src[i]); return 0; + case DMUO_SINH: + for (int i = 0; i < dims_count; ++i) + dst[i] = sinh(src[i]); + return 0; default: return -1; } diff --git a/libavfilter/dnn/dnn_backend_native_layer_mathunary.h b/libavfilter/dnn/dnn_backend_native_layer_mathunary.h index 13fa33178a..760930c60e 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_mathunary.h +++ b/libavfilter/dnn/dnn_backend_native_layer_mathunary.h @@ -37,6 +37,7 @@ typedef enum { DMUO_ASIN = 4, DMUO_ACOS = 5, DMUO_ATAN = 6, + DMUO_SINH = 7, DMUO_COUNT } DNNMathUnaryOperation; diff --git a/tools/python/convert_from_tensorflow.py b/tools/python/convert_from_tensorflow.py index b90c31c495..6f34a71ab4 100644 --- a/tools/python/convert_from_tensorflow.py +++ b/tools/python/convert_from_tensorflow.py @@ -72,7 +72,7 @@ class TFConverter: self.conv2d_scopename_inputname_dict = {} self.op2code = {'Conv2D':1, 'DepthToSpace':2, 'MirrorPad':3, 'Maximum':4, 'MathBinary':5, 'MathUnary':6} self.mathbin2code = {'Sub':0, 'Add':1, 'Mul':2, 'RealDiv':3, 'Minimum':4} - self.mathun2code = {'Abs':0, 'Sin':1, 'Cos':2, 'Tan':3, 'Asin':4, 'Acos':5, 'Atan':6} + self.mathun2code = {'Abs':0, 'Sin':1, 'Cos':2, 'Tan':3, 'Asin':4, 'Acos':5, 'Atan':6, 'Sinh':7} self.mirrorpad_mode = {'CONSTANT':0, 'REFLECT':1, 'SYMMETRIC':2} self.name_operand_dict = {} diff --git a/tools/python/convert_header.py b/tools/python/convert_header.py index 73cf23bf53..4747f41395 100644 --- a/tools/python/convert_header.py +++ b/tools/python/convert_header.py @@ -23,4 +23,4 @@ str = 'FFMPEGDNNNATIVE' major = 1 # increase minor when we don't have to re-convert the model file -minor = 12 +minor = 13 From patchwork Mon Jun 29 14:54:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Fu, Ting" X-Patchwork-Id: 20732 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:80ca:0:0:0:0:0 with SMTP id c10csp2875997ybm; Mon, 29 Jun 2020 08:00:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTsksuqDN4Xb8UQ9YMc25Bm4vR/HKSncxk2llXTUFDo4H/h+br7Qj2wi+6hi5ccFAN2bVW X-Received: by 2002:adf:8104:: with SMTP id 4mr17677772wrm.18.1593442816115; Mon, 29 Jun 2020 08:00:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593442816; cv=none; d=google.com; s=arc-20160816; b=K+ugHt56yyqy0pUeSczQs83Q+ofZYV223f3Aq68AzITcQa+xAB6EqeJqAfm9+YeiQE w7SdjlkSV4xBUuIX1YVFwG11J9vrbaner63UpU4VjHNMA83GZb1aw4coTh3wo/R3dqrh rGWa44qzoCpdgk+cPW3zkAY0e5WH6peZmQIgoCPYI82hjya7c6p/H4wPhbE0HgkB91py +y0KS3AVYtVbq2KXay7MrqYWm3PxYYxz9FRdBsdVlaNLpLINnRZ4HtGF+CWo6wsqQlXZ 9Rcynyu1L3LRP8ZpZpAJgk8b2oZEyMaTHoHKgtJeWLTuCacSOHGDeLOc1fCbQqbEwHQG 38nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:ironport-sdr:ironport-sdr:delivered-to; bh=kfzZbcS0GLiEHPLFpNPKZyUSXQ6ExHP33goeOlvSxSs=; b=EXv1lv5NFzfQGQqFgsl9xaNCro0vg2FRw7kYwj4gmZCEKB8rTdJ3aYq4Eiw41b9PpO dgYaPIxtw3wRinSmPnnrMjKg69wCOS9Ebln7elNyE8rZdlk+k4fh2X6nIdakuXyG6nQP unuT4tFA04Fyp+/fhiBwNZVaSZsnQP9xTVKKNydSwKLjXvusG7OTNW9gmsGh93vDUlGS Do9/7rM+uCOJWnEpHx+qnyasg0jwIPbEFdxz14W5vPQy7vCF3mqy8duZUQ22X5f9YREP Z1uNj86y0esdKtEU9kf4NiAJ/QEIoaQpSYWK5N/XtnPExeqyWCUuemIh1DDT9cc5Yp5a 7Dyw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id k83si192694wma.39.2020.06.29.08.00.15; Mon, 29 Jun 2020 08:00:16 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8A63268A646; Mon, 29 Jun 2020 18:00:05 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 97C616880EF for ; Mon, 29 Jun 2020 17:59:57 +0300 (EEST) IronPort-SDR: ZcIjdz/z648dnGmKH9h57HizTtOFzD6OKKYeNgMqtXJ3RtDyDg3KtoDF0IL8+1X/TqvpOtQzV0 6fML7qI8TFFQ== X-IronPort-AV: E=McAfee;i="6000,8403,9666"; a="144173127" X-IronPort-AV: E=Sophos;i="5.75,295,1589266800"; d="scan'208";a="144173127" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2020 07:59:55 -0700 IronPort-SDR: gFMiWLLOryEGYvzlII+VzJwiMYql/gqomQ2q7h8qGljoZmu9AB0jcVatcKUhWfmeMp1uaz5F1n BoDYAka5Byow== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,295,1589266800"; d="scan'208";a="313069743" Received: from semmer-ubuntu.sh.intel.com ([10.239.159.54]) by fmsmga002.fm.intel.com with ESMTP; 29 Jun 2020 07:59:54 -0700 From: Ting Fu To: ffmpeg-devel@ffmpeg.org Date: Mon, 29 Jun 2020 22:54:01 +0800 Message-Id: <20200629145411.24005-2-ting.fu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200629145411.24005-1-ting.fu@intel.com> References: <20200629145411.24005-1-ting.fu@intel.com> Subject: [FFmpeg-devel] [PATCH V2 02/12] dnn-layer-math-unary-test: add unit test for sinh 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" X-TUID: pbc/BtVAZYb3 Content-Length: 1427 Signed-off-by: Ting Fu --- tests/dnn/dnn-layer-mathunary-test.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/dnn/dnn-layer-mathunary-test.c b/tests/dnn/dnn-layer-mathunary-test.c index bf77c44bbe..a1ff05e5fb 100644 --- a/tests/dnn/dnn-layer-mathunary-test.c +++ b/tests/dnn/dnn-layer-mathunary-test.c @@ -44,6 +44,8 @@ static float get_expected(float f, DNNMathUnaryOperation op) return acos(f); case DMUO_ATAN: return atan(f); + case DMUO_SINH: + return sinh(f); default: av_assert0(!"not supported yet"); return 0.f; @@ -101,5 +103,7 @@ int main(int agrc, char **argv) return 1; if (test(DMUO_ATAN)) return 1; + if (test(DMUO_SINH)) + return 1; return 0; } From patchwork Mon Jun 29 14:54:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Fu, Ting" X-Patchwork-Id: 20712 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:80ca:0:0:0:0:0 with SMTP id c10csp2876228ybm; Mon, 29 Jun 2020 08:00:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyq+UJwi7+ZXPbk3BXhLJgN8VK6Mmjh6t8bi3XaI6OcYt/w6US4Yih/udSHW+R60P8So2RN X-Received: by 2002:adf:9525:: with SMTP id 34mr18367351wrs.313.1593442833272; Mon, 29 Jun 2020 08:00:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593442833; cv=none; d=google.com; s=arc-20160816; b=agE3rpNLNd7CNs+GM9BPl6IJmWgQLMCNeFAGxRpsGCre4Q3OoPLOyQMNBSf6AIE/Ik FUwxO5TsGNlWCf5YJHMc9TjSFcM1aOlNJunJ5kGSBUKGU7/b0JdZf8JFD7U+gf5ZtR5c aL2sape+C3ho6u1bL2v5FyFrA0fDVSs/4wOBHSa6hNurquWxIb5YFHemAq0JovC31bdk hme24m0FtYGd2RMRjtpFtm3TqjJtBh5BLunuX4ke+pyzNps5J/7hBnAKjNksBUx+ttj0 7Z5GOXHpmcH06mFAVGaPIsHyeRPTXwxWzhB3jhQ90c167r6yXcPFfTcSgVujauyPiCaU zZzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:ironport-sdr:ironport-sdr:delivered-to; bh=IKMWjMB0hGLYnZsx4RyoLTNhMcOuVm5E9Ck9ZyKmB+I=; b=pKamh8ezolcNBHsVxGHZIg9V+dEIIjAgmiLzk/pRZHB7bZrToylm1/hZHxtmovY/b6 uh7iDNKMY3Y0EJI0g7vYwkyl2/0/Es9YUaGtgWP0CuXP5jgqWl1icggHNId/cTLJcc2c Irl2uDSICCtxBRK7AglZvuyAdwiEzwruwYneO7M1CkHF+9yTuq67X+HQ+0IrlEqT4aE/ +9ORNfLO0vYw+WgyjhD3ZTkB+aLneF1CZnWRbBXKGX3/ISYDcIWTTWWJ6undfwBSWSbd M1QgKp68rhpbWlOEKy+MIs6puNuLegEysoDx7U/YHWhZtslasTV5FT9C2khglrELBbBC /64A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id t3si160472wrm.3.2020.06.29.08.00.32; Mon, 29 Jun 2020 08:00:33 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A774168AA6B; Mon, 29 Jun 2020 18:00:06 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 29A2468A295 for ; Mon, 29 Jun 2020 17:59:58 +0300 (EEST) IronPort-SDR: rD+hrNVnviLAOi/7qdLcGTP1qb6lKkEZs3D8LHJ5pWgG7kvf444wSkmt9mPNjBdKfET0x5mPoA swtjG0PkMUBg== X-IronPort-AV: E=McAfee;i="6000,8403,9666"; a="144173129" X-IronPort-AV: E=Sophos;i="5.75,295,1589266800"; d="scan'208";a="144173129" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2020 07:59:55 -0700 IronPort-SDR: u6XZcETSFeql8uXROt59saRowh52hB/n6klKb+bXuyzteER8kHOmENztwP6/UFUsP35FvkAu5X 77zp79rOF6mQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,295,1589266800"; d="scan'208";a="313069746" Received: from semmer-ubuntu.sh.intel.com ([10.239.159.54]) by fmsmga002.fm.intel.com with ESMTP; 29 Jun 2020 07:59:55 -0700 From: Ting Fu To: ffmpeg-devel@ffmpeg.org Date: Mon, 29 Jun 2020 22:54:02 +0800 Message-Id: <20200629145411.24005-3-ting.fu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200629145411.24005-1-ting.fu@intel.com> References: <20200629145411.24005-1-ting.fu@intel.com> Subject: [FFmpeg-devel] [PATCH V2 03/12] dnn_backend_native_layer_mathunary: add cosh support 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" X-TUID: HokAnq+O2HB3 Content-Length: 3855 Signed-off-by: Ting Fu --- libavfilter/dnn/dnn_backend_native_layer_mathunary.c | 4 ++++ libavfilter/dnn/dnn_backend_native_layer_mathunary.h | 1 + tools/python/convert_from_tensorflow.py | 2 +- tools/python/convert_header.py | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/libavfilter/dnn/dnn_backend_native_layer_mathunary.c b/libavfilter/dnn/dnn_backend_native_layer_mathunary.c index 2630fe07e2..ddb70996e7 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_mathunary.c +++ b/libavfilter/dnn/dnn_backend_native_layer_mathunary.c @@ -108,6 +108,10 @@ int dnn_execute_layer_math_unary(DnnOperand *operands, const int32_t *input_oper for (int i = 0; i < dims_count; ++i) dst[i] = sinh(src[i]); return 0; + case DMUO_COSH: + for (int i = 0; i < dims_count; ++i) + dst[i] = cosh(src[i]); + return 0; default: return -1; } diff --git a/libavfilter/dnn/dnn_backend_native_layer_mathunary.h b/libavfilter/dnn/dnn_backend_native_layer_mathunary.h index 760930c60e..5a486b4f5f 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_mathunary.h +++ b/libavfilter/dnn/dnn_backend_native_layer_mathunary.h @@ -38,6 +38,7 @@ typedef enum { DMUO_ACOS = 5, DMUO_ATAN = 6, DMUO_SINH = 7, + DMUO_COSH = 8, DMUO_COUNT } DNNMathUnaryOperation; diff --git a/tools/python/convert_from_tensorflow.py b/tools/python/convert_from_tensorflow.py index 6f34a71ab4..96da44c4a8 100644 --- a/tools/python/convert_from_tensorflow.py +++ b/tools/python/convert_from_tensorflow.py @@ -72,7 +72,7 @@ class TFConverter: self.conv2d_scopename_inputname_dict = {} self.op2code = {'Conv2D':1, 'DepthToSpace':2, 'MirrorPad':3, 'Maximum':4, 'MathBinary':5, 'MathUnary':6} self.mathbin2code = {'Sub':0, 'Add':1, 'Mul':2, 'RealDiv':3, 'Minimum':4} - self.mathun2code = {'Abs':0, 'Sin':1, 'Cos':2, 'Tan':3, 'Asin':4, 'Acos':5, 'Atan':6, 'Sinh':7} + self.mathun2code = {'Abs':0, 'Sin':1, 'Cos':2, 'Tan':3, 'Asin':4, 'Acos':5, 'Atan':6, 'Sinh':7, 'Cosh':8} self.mirrorpad_mode = {'CONSTANT':0, 'REFLECT':1, 'SYMMETRIC':2} self.name_operand_dict = {} diff --git a/tools/python/convert_header.py b/tools/python/convert_header.py index 4747f41395..a73f51ba48 100644 --- a/tools/python/convert_header.py +++ b/tools/python/convert_header.py @@ -23,4 +23,4 @@ str = 'FFMPEGDNNNATIVE' major = 1 # increase minor when we don't have to re-convert the model file -minor = 13 +minor = 14 From patchwork Mon Jun 29 14:54:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Fu, Ting" X-Patchwork-Id: 20724 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:80ca:0:0:0:0:0 with SMTP id c10csp2876351ybm; Mon, 29 Jun 2020 08:00:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhgJ6lN5jdppJxqbcA/67j/RXgqitAt9JiI0fNTFzYE3QC27PrZDcv5oF1zUagbdNL7aTz X-Received: by 2002:a1c:9911:: with SMTP id b17mr13760318wme.135.1593442840559; Mon, 29 Jun 2020 08:00:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593442840; cv=none; d=google.com; s=arc-20160816; b=HcBG2qs2GMNACh0bT9uCCe9sPRhReHKRYezmE0UA6RtlaAMNAwdAQXxhbVJ2Y533R2 9N2c2mBcSG+xU1zPBes1Z61i7ZzDEtKQfVIpoLeSHP36aemHcCC6Z4PfotetVsVwB7YT JdLvF27jKHAXDwwUaOLXL+Vc696mpIKtscL39Y/OVtlaxCt5owuQGI4+70v9BHQM5jZR ZQ52YFnstybJbz/YIC2RWAYmf4G+0S+fG+n7kvU2SNWVbdx6YzIGpcuvg7lwb82zt3ur JVA8JS/0czW3cj4lOy7xDGpkPxj8wLi3tqPF9ArwN4WIZwUHAXsFeLVMjPHRprBXnSzc lAXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:ironport-sdr:ironport-sdr:delivered-to; bh=FcyQ1DfLt9hasA5aCharSvl25BCJTG3ltMpx4g9l3J0=; b=j9S26CQL8hKAdoBsMvYTA2rntqWLkQciovxYicMjykWwB631S0voUYfeAmmbpchFBy 4FbkSSc9nW6Llez5e5HzMHHQWntKgsAz4JQIc5e3B3uhc3c/WybFmhpg2odKB4OEcfU/ Ra1klP516F9UjN+JgJA9IhaD1u7dVaaJXh6BCIuF4OmHV9lN6ulwa8pFuUaqaaEL3q7J riDUQYaag6BZ+Zn2iI28fmc31qGGLvSAqvVjBIQyfxsMY41q/Rwf+wNOEb3HY/2IDO9k +AdvrE6jSsJLTQ/MntKh/CueBc5pUDW5m9uyIni3WUUAx4nw/uHb7VoK2X+jBPB74tPc 5XqA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id l26si201272wmi.40.2020.06.29.08.00.40; Mon, 29 Jun 2020 08:00:40 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1B87468AA89; Mon, 29 Jun 2020 18:00:09 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E929468AA6E for ; Mon, 29 Jun 2020 18:00:01 +0300 (EEST) IronPort-SDR: GjSjkL04xWWsx3FpxunpJcTE4eV/meu+/Z8MgaUYv2TKBvUC7Iy3tRp40RHEduMVH3uXh9B3/N Pz2Zz9dR0cGg== X-IronPort-AV: E=McAfee;i="6000,8403,9666"; a="144173132" X-IronPort-AV: E=Sophos;i="5.75,295,1589266800"; d="scan'208";a="144173132" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2020 07:59:56 -0700 IronPort-SDR: fq+OBr6mx2iP3hPmFlI3SfuoLNBGPGtY5XmD8oHY5Sl2E1LBpOEQ5etf3KrM8WXHqnPaB+oo4U UVQC2B1wwiCA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,295,1589266800"; d="scan'208";a="313069749" Received: from semmer-ubuntu.sh.intel.com ([10.239.159.54]) by fmsmga002.fm.intel.com with ESMTP; 29 Jun 2020 07:59:56 -0700 From: Ting Fu To: ffmpeg-devel@ffmpeg.org Date: Mon, 29 Jun 2020 22:54:03 +0800 Message-Id: <20200629145411.24005-4-ting.fu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200629145411.24005-1-ting.fu@intel.com> References: <20200629145411.24005-1-ting.fu@intel.com> Subject: [FFmpeg-devel] [PATCH V2 04/12] dnn-layer-math-unary-test: add unit test for cosh 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" X-TUID: WVNLSb+je2yq Content-Length: 1427 Signed-off-by: Ting Fu --- tests/dnn/dnn-layer-mathunary-test.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/dnn/dnn-layer-mathunary-test.c b/tests/dnn/dnn-layer-mathunary-test.c index a1ff05e5fb..0280debc0b 100644 --- a/tests/dnn/dnn-layer-mathunary-test.c +++ b/tests/dnn/dnn-layer-mathunary-test.c @@ -46,6 +46,8 @@ static float get_expected(float f, DNNMathUnaryOperation op) return atan(f); case DMUO_SINH: return sinh(f); + case DMUO_COSH: + return cosh(f); default: av_assert0(!"not supported yet"); return 0.f; @@ -105,5 +107,7 @@ int main(int agrc, char **argv) return 1; if (test(DMUO_SINH)) return 1; + if (test(DMUO_COSH)) + return 1; return 0; } From patchwork Mon Jun 29 14:54:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Fu, Ting" X-Patchwork-Id: 20726 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:80ca:0:0:0:0:0 with SMTP id c10csp2876518ybm; Mon, 29 Jun 2020 08:00:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQJHcVtH9D9+KgjyLUJLw4WG7Tp3F8aGpJiM9QH1voa8kucd9BDrJRCAGoH8Z2hgHEI2fW X-Received: by 2002:a5d:5310:: with SMTP id e16mr16607432wrv.289.1593442852571; Mon, 29 Jun 2020 08:00:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593442852; cv=none; d=google.com; s=arc-20160816; b=a9tZf7/sloojgRevJUtMT5lDwPqoRMJMJEe2mgDwb7T6xiwUND+6zOx9tl1Qm+hHqf YR7g8HoxLAk7O3sh5fvwOKnPQAKPbaDsXivLJdf4MWh7J2AisowutWxbkvinZtGC3Le6 69BF7u4HRhbsUDBq39ewBE0ezOzD9EL6IYzR0J/W49NlOnCsLJ3D0s0ymxQdU2XUccYa SnOWHqaUWUOBwx+tAOb8LRBwKdT+MhBqhTQqBWL5i5eZeh707kzjBMwizMqbVw4bKvrO 3h/0kmguTZ2Z4N66dbCprgyCAdgWGqo0tfgJQquChxVxE/uxea8yaqCuA271xn4bJ2cD 4Y9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:ironport-sdr:ironport-sdr:delivered-to; bh=Lh3IRztxkSxWuy/eX0fx0o3VcNmZqAiT1XVxVYaxi28=; b=J7aUtiWSoDNaOihuyIXw1ZyAJFDEhT1SvVMXouit2MbyYOzeO4gOJmcglY/RRQU01v jGCQDLRCqBURu0aVsAXPCC/IRxSnQAiiccvD0OlGmr6QJiXVpNTLoCuVxkHTNPzyodgY PbtLtLhrfoHvZhXag6YwF5XdoJQOfY0WI4DcUjSucO4fu04ABZ1NfacCXowsZ8Tid+4y HVFHc+oCsYkewbT1s0NvvnxJZBIiyxlUa+WUuU5CJ9zhjnPKCSpoD1WT2obPNVYQ2TDs b2i37bLqQfFxlnrblBqxYwjvliig2ydfKfSOaaM3AgxiB0SPpRwsbDZJu3YByRkMG2zf 0udQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id i3si149669wri.274.2020.06.29.08.00.52; Mon, 29 Jun 2020 08:00:52 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0839968AAD8; Mon, 29 Jun 2020 18:00:11 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8038C6881F5 for ; Mon, 29 Jun 2020 18:00:03 +0300 (EEST) IronPort-SDR: 8AKZF1PfnBlDtSVXcmOVhRqb/OUuQwoirXv+92UUGI9TD/Aoda5DcZaf9YeKkAANdFL3TZiSnU +4SnZIYbWAJg== X-IronPort-AV: E=McAfee;i="6000,8403,9666"; a="144173133" X-IronPort-AV: E=Sophos;i="5.75,295,1589266800"; d="scan'208";a="144173133" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2020 07:59:57 -0700 IronPort-SDR: JdXpmkgXOMK4QU8tZ575hyzazXWmJh0O6JcfYRjjmvAo38SyAdYOMZynfQXw/5OZznfC9aXgai /Lvpj/2t5h+w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,295,1589266800"; d="scan'208";a="313069756" Received: from semmer-ubuntu.sh.intel.com ([10.239.159.54]) by fmsmga002.fm.intel.com with ESMTP; 29 Jun 2020 07:59:56 -0700 From: Ting Fu To: ffmpeg-devel@ffmpeg.org Date: Mon, 29 Jun 2020 22:54:04 +0800 Message-Id: <20200629145411.24005-5-ting.fu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200629145411.24005-1-ting.fu@intel.com> References: <20200629145411.24005-1-ting.fu@intel.com> Subject: [FFmpeg-devel] [PATCH V2 05/12] dnn_backend_native_layer_mathunary: add tanh support 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" X-TUID: 0/Wa7Kyc5N9P Content-Length: 3883 Signed-off-by: Ting Fu --- libavfilter/dnn/dnn_backend_native_layer_mathunary.c | 4 ++++ libavfilter/dnn/dnn_backend_native_layer_mathunary.h | 1 + tools/python/convert_from_tensorflow.py | 2 +- tools/python/convert_header.py | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/libavfilter/dnn/dnn_backend_native_layer_mathunary.c b/libavfilter/dnn/dnn_backend_native_layer_mathunary.c index ddb70996e7..ccdbcc21e0 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_mathunary.c +++ b/libavfilter/dnn/dnn_backend_native_layer_mathunary.c @@ -112,6 +112,10 @@ int dnn_execute_layer_math_unary(DnnOperand *operands, const int32_t *input_oper for (int i = 0; i < dims_count; ++i) dst[i] = cosh(src[i]); return 0; + case DMUO_TANH: + for (int i = 0; i < dims_count; ++i) + dst[i] = tanh(src[i]); + return 0; default: return -1; } diff --git a/libavfilter/dnn/dnn_backend_native_layer_mathunary.h b/libavfilter/dnn/dnn_backend_native_layer_mathunary.h index 5a486b4f5f..ae0c1e1cdd 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_mathunary.h +++ b/libavfilter/dnn/dnn_backend_native_layer_mathunary.h @@ -39,6 +39,7 @@ typedef enum { DMUO_ATAN = 6, DMUO_SINH = 7, DMUO_COSH = 8, + DMUO_TANH = 9, DMUO_COUNT } DNNMathUnaryOperation; diff --git a/tools/python/convert_from_tensorflow.py b/tools/python/convert_from_tensorflow.py index 96da44c4a8..f98a3cae3d 100644 --- a/tools/python/convert_from_tensorflow.py +++ b/tools/python/convert_from_tensorflow.py @@ -72,7 +72,7 @@ class TFConverter: self.conv2d_scopename_inputname_dict = {} self.op2code = {'Conv2D':1, 'DepthToSpace':2, 'MirrorPad':3, 'Maximum':4, 'MathBinary':5, 'MathUnary':6} self.mathbin2code = {'Sub':0, 'Add':1, 'Mul':2, 'RealDiv':3, 'Minimum':4} - self.mathun2code = {'Abs':0, 'Sin':1, 'Cos':2, 'Tan':3, 'Asin':4, 'Acos':5, 'Atan':6, 'Sinh':7, 'Cosh':8} + self.mathun2code = {'Abs':0, 'Sin':1, 'Cos':2, 'Tan':3, 'Asin':4, 'Acos':5, 'Atan':6, 'Sinh':7, 'Cosh':8, 'Tanh':9} self.mirrorpad_mode = {'CONSTANT':0, 'REFLECT':1, 'SYMMETRIC':2} self.name_operand_dict = {} diff --git a/tools/python/convert_header.py b/tools/python/convert_header.py index a73f51ba48..d2753f0af0 100644 --- a/tools/python/convert_header.py +++ b/tools/python/convert_header.py @@ -23,4 +23,4 @@ str = 'FFMPEGDNNNATIVE' major = 1 # increase minor when we don't have to re-convert the model file -minor = 14 +minor = 15 From patchwork Mon Jun 29 14:54:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Fu, Ting" X-Patchwork-Id: 20731 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:80ca:0:0:0:0:0 with SMTP id c10csp2876652ybm; Mon, 29 Jun 2020 08:01:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJypY1vBViUZAgGHHk97V6Ns61MK2Slb32cLHSApy57SAI0eatZBEnW2wJ8CExxLiSARS8HU X-Received: by 2002:a1c:f003:: with SMTP id a3mr16747089wmb.119.1593442864100; Mon, 29 Jun 2020 08:01:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593442864; cv=none; d=google.com; s=arc-20160816; b=EtyF5ZFYyhFbCq1E4mHOaRGQQoeMY6y9Ixc72b/OvfoBStdl1cRAofxtviXR3Hm+u5 Tk/U9CQ4Hnqn0EuYoKMK5cUQpPA0DI2izy9biA5luUuEZ7HuOJOfTDyAfMxwZj95dVlJ UiNv1UsPYLRl96hoCQ65V6SGz9niIexX9yFhYXu36Ck7w9H3jKRFveU3C81/Dbs/tq7Z ysbPXPTD2i+EwkI+FPtEyC0y1bk9gWadL3N3xB7+3gK3kGTMQbsf7s0ayARZsHOnCsVx tMVeTZXzTCwNwKe8R7NOzHzgjLkH6fs72vHmyRuundVU3G8IFXB9ekothGljNJqAYBPU cnmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:ironport-sdr:ironport-sdr:delivered-to; bh=RkaNqi4LuhkAuaabJXrETV9Kx/pBcho1EP1Cl0TyxYo=; b=v911PNr6VSUB5VwCmIL6tgUEKlDNwEkpmHDrSopE95ZOQ3lPzknw6z9ozWNmry3xYV Vo29tu5M3XVix57ldnCks7VkgLk0xxViX+FCtoWLAGdL2+5di/bVlaM9m/p5+OquRa7F 5M3BaNZ+I6bfjJVUC0raeoxl1S1i9+OnX9twUD0rl5OhyGftjK/FegQtJubqyf6hoo+o b54S8clCf2LOoVHl5zR/3e2qhWuEfPEBesIuiB+028FR3F/AkQYVp7NOiejSn93Kvou3 3EZWZwFwzx7RuV6BDcqqGoucU+ZMBa3dXtOL7wHIulQU7AhXVI1rOhuLjUTzCjQHREdr Omqw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id d1si129168wrg.525.2020.06.29.08.01.03; Mon, 29 Jun 2020 08:01:04 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BC4A268AB72; Mon, 29 Jun 2020 18:00:13 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 15227688077 for ; Mon, 29 Jun 2020 18:00:04 +0300 (EEST) IronPort-SDR: wpudzVOPlKpp/lJ7xea9RPsguS9OyhaJ9geaD0/F3dMYufadv9AKxHOEwgXG9CDxsLn7o1y/T5 9lGkvQCbrVUQ== X-IronPort-AV: E=McAfee;i="6000,8403,9666"; a="144173136" X-IronPort-AV: E=Sophos;i="5.75,295,1589266800"; d="scan'208";a="144173136" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2020 07:59:58 -0700 IronPort-SDR: mDN0k0BtAiZDp7xenm9X2n/88NPvnY0SvBX6hdcSRS+ePGyTEwFkdKPO6DIyhd1l+93repzIWm ifYGzULZ6s6w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,295,1589266800"; d="scan'208";a="313069759" Received: from semmer-ubuntu.sh.intel.com ([10.239.159.54]) by fmsmga002.fm.intel.com with ESMTP; 29 Jun 2020 07:59:57 -0700 From: Ting Fu To: ffmpeg-devel@ffmpeg.org Date: Mon, 29 Jun 2020 22:54:05 +0800 Message-Id: <20200629145411.24005-6-ting.fu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200629145411.24005-1-ting.fu@intel.com> References: <20200629145411.24005-1-ting.fu@intel.com> Subject: [FFmpeg-devel] [PATCH V2 06/12] dnn-layer-math-unary-test: add unit test for tanh 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" X-TUID: qxPj5VBcA3U4 Content-Length: 1427 Signed-off-by: Ting Fu --- tests/dnn/dnn-layer-mathunary-test.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/dnn/dnn-layer-mathunary-test.c b/tests/dnn/dnn-layer-mathunary-test.c index 0280debc0b..6885b4d318 100644 --- a/tests/dnn/dnn-layer-mathunary-test.c +++ b/tests/dnn/dnn-layer-mathunary-test.c @@ -48,6 +48,8 @@ static float get_expected(float f, DNNMathUnaryOperation op) return sinh(f); case DMUO_COSH: return cosh(f); + case DMUO_TANH: + return tanh(f); default: av_assert0(!"not supported yet"); return 0.f; @@ -109,5 +111,7 @@ int main(int agrc, char **argv) return 1; if (test(DMUO_COSH)) return 1; + if (test(DMUO_TANH)) + return 1; return 0; } From patchwork Mon Jun 29 14:54:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Fu, Ting" X-Patchwork-Id: 20715 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:80ca:0:0:0:0:0 with SMTP id c10csp2877213ybm; Mon, 29 Jun 2020 08:01:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNFpk0cy+4W7purd6KXmHe8hWxxp2YND8xjSTQ8a5Cqqq8Qays19oCT5lCJjc28BsNOd1A X-Received: by 2002:adf:f6cb:: with SMTP id y11mr16734924wrp.100.1593442900769; Mon, 29 Jun 2020 08:01:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593442900; cv=none; d=google.com; s=arc-20160816; b=ZvvZcQU5F4zhWpi1i6CY4/R17KtLpDuOd7BeTD1Q0nrSsvnYsdqQ9WpWQb1pqnCiKV qWeYq33L5Ro1frTWsbflmxbwznn70M+0zKt/ck6fQcDBw07WFKIvNLONDS4K8wSAyPiy qJwPloLsWnd+kqSvu1uOBcbL3f4eCAiidpAUsEWz2R8+QPteH55lZIGa5oCgA0OyzSQe ZqemnnhPYXsunpSPdLLitYokdyMhl6d1+RzGJ6IiMoBNILaZmkkVRavy8a2bCXF4N6jA dInUUv0/yyp/IEIJp+lHQBUOKO3WAxmLUvz3UKKduUudpDjLto3U2LKQdKGaAp5UI0G6 y1QA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:ironport-sdr:ironport-sdr:delivered-to; bh=+eK+ugaFyqVreudSFNQNGo/tuir5+NsC6xBIFL55nxM=; b=g1Jc9R7aLBlJ4qE3p2KUmrALBP74aAn0jPh+aPhnahNmETfnQcRYgnZJQLq4VFFVw4 3IXnckgYzYhSxBqK3xdNU7WHnW5OX8VLPHxekmZZkgciiu644f2uYe2PeXBR/BF4rhKo dv7gI1G++RCE0Gtr9FikRXZd0ut+sKY/DspG8xgssSiPa+PzG10Y/F4g0FzUt/l8Jcc5 nJAeLKySlCC6mX9VzRqB0eE9JwWA2enaepYcZBM3UcQvsBvgdISuvBwurv6xKR88aC7U SQFC/dG3LKPoxJZVAiiY5LZBh2UPZ6MCFJSNMPwTx5MQsGQKKFG8/dzr5TtYePQuZFiw 5huA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id z17si184087wmi.119.2020.06.29.08.01.40; Mon, 29 Jun 2020 08:01:40 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 25C4D68AD9A; Mon, 29 Jun 2020 18:00:18 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D5DCA68A4D4 for ; Mon, 29 Jun 2020 18:00:07 +0300 (EEST) IronPort-SDR: G/OE5nhHQpcIzN5mWIxJ05MIPH2oPoojAnAzzJE1haLrrFP6VFePUYwxoGtcU5xh6D7Bt9M5LU 5KXKx7+DWPKQ== X-IronPort-AV: E=McAfee;i="6000,8403,9666"; a="144173140" X-IronPort-AV: E=Sophos;i="5.75,295,1589266800"; d="scan'208";a="144173140" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2020 07:59:59 -0700 IronPort-SDR: w2XTBovriTORA/l9fYT24/P/19hfQYpDXXV1VITWeRae+199MYojLk8MUQy1MgNlBx65qLFDkv 92rktYZno8JA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,295,1589266800"; d="scan'208";a="313069767" Received: from semmer-ubuntu.sh.intel.com ([10.239.159.54]) by fmsmga002.fm.intel.com with ESMTP; 29 Jun 2020 07:59:58 -0700 From: Ting Fu To: ffmpeg-devel@ffmpeg.org Date: Mon, 29 Jun 2020 22:54:06 +0800 Message-Id: <20200629145411.24005-7-ting.fu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200629145411.24005-1-ting.fu@intel.com> References: <20200629145411.24005-1-ting.fu@intel.com> Subject: [FFmpeg-devel] [PATCH V2 07/12] dnn_backend_native_layer_mathunary: add asinh support 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" X-TUID: 09NbMQNveiLY Content-Length: 3919 Signed-off-by: Ting Fu --- libavfilter/dnn/dnn_backend_native_layer_mathunary.c | 4 ++++ libavfilter/dnn/dnn_backend_native_layer_mathunary.h | 1 + tools/python/convert_from_tensorflow.py | 2 +- tools/python/convert_header.py | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/libavfilter/dnn/dnn_backend_native_layer_mathunary.c b/libavfilter/dnn/dnn_backend_native_layer_mathunary.c index ccdbcc21e0..83df98d0f8 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_mathunary.c +++ b/libavfilter/dnn/dnn_backend_native_layer_mathunary.c @@ -116,6 +116,10 @@ int dnn_execute_layer_math_unary(DnnOperand *operands, const int32_t *input_oper for (int i = 0; i < dims_count; ++i) dst[i] = tanh(src[i]); return 0; + case DMUO_ASINH: + for (int i = 0; i < dims_count; ++i) + dst[i] = asinh(src[i]); + return 0; default: return -1; } diff --git a/libavfilter/dnn/dnn_backend_native_layer_mathunary.h b/libavfilter/dnn/dnn_backend_native_layer_mathunary.h index ae0c1e1cdd..fbe9af5c7d 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_mathunary.h +++ b/libavfilter/dnn/dnn_backend_native_layer_mathunary.h @@ -40,6 +40,7 @@ typedef enum { DMUO_SINH = 7, DMUO_COSH = 8, DMUO_TANH = 9, + DMUO_ASINH = 10, DMUO_COUNT } DNNMathUnaryOperation; diff --git a/tools/python/convert_from_tensorflow.py b/tools/python/convert_from_tensorflow.py index f98a3cae3d..0d756c8109 100644 --- a/tools/python/convert_from_tensorflow.py +++ b/tools/python/convert_from_tensorflow.py @@ -72,7 +72,7 @@ class TFConverter: self.conv2d_scopename_inputname_dict = {} self.op2code = {'Conv2D':1, 'DepthToSpace':2, 'MirrorPad':3, 'Maximum':4, 'MathBinary':5, 'MathUnary':6} self.mathbin2code = {'Sub':0, 'Add':1, 'Mul':2, 'RealDiv':3, 'Minimum':4} - self.mathun2code = {'Abs':0, 'Sin':1, 'Cos':2, 'Tan':3, 'Asin':4, 'Acos':5, 'Atan':6, 'Sinh':7, 'Cosh':8, 'Tanh':9} + self.mathun2code = {'Abs':0, 'Sin':1, 'Cos':2, 'Tan':3, 'Asin':4, 'Acos':5, 'Atan':6, 'Sinh':7, 'Cosh':8, 'Tanh':9, 'Asinh':10} self.mirrorpad_mode = {'CONSTANT':0, 'REFLECT':1, 'SYMMETRIC':2} self.name_operand_dict = {} diff --git a/tools/python/convert_header.py b/tools/python/convert_header.py index d2753f0af0..3211c13f6d 100644 --- a/tools/python/convert_header.py +++ b/tools/python/convert_header.py @@ -23,4 +23,4 @@ str = 'FFMPEGDNNNATIVE' major = 1 # increase minor when we don't have to re-convert the model file -minor = 15 +minor = 16 From patchwork Mon Jun 29 14:54:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Fu, Ting" X-Patchwork-Id: 20725 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:80ca:0:0:0:0:0 with SMTP id c10csp2877848ybm; Mon, 29 Jun 2020 08:02:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/QzI+n0C7Vzf7L7T6ML9QncmyJ3Tf1ibKffcj0AAwuiTLIo+NDQCK3eEqEtYTTuFf6ETp X-Received: by 2002:a1c:1d6:: with SMTP id 205mr16521436wmb.2.1593442940857; Mon, 29 Jun 2020 08:02:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593442940; cv=none; d=google.com; s=arc-20160816; b=HYKvc2JFJIKDXNAvnJdco+eZ0ZCbRgNwkAoZOk3cwJBsgNK/VqOrDuPyAhgUOt1eKR Rg+OjNwKtDZKAnBsxDjjzvjxmL+Ou9e2I51H0MyAz9XULTgOCcyieBNylwFEU4VPAGsJ gZfBGoPNlbaonz9Zo4jfRcbRgAFri6Kzmi06KOliymXVmx3tnPtetKjtg1fZRgeKgE6U bsriCDijMneGLbSSGhS26e24P8BABmuy9pXfCz+tHvGUFLsXNPB3VkeNBS/RBtZoXV7v YcItnjGZyR6cf9qlZ1J+bvuLQxUskRGkg1u0lcJ6g7EouswyMoFXd0ERF4CsWMUZtgWx O4fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:ironport-sdr:ironport-sdr:delivered-to; bh=zC632L2a5vSti+xWJknwNGsrNzoNB/+4CFnWlNKqPqU=; b=yJhFZsiVEoY9aXBhZcNyS2SyP2eO8IZcEzRDhed+iQ8i4HOK1GQA3KzqkbiqAYws0u V/SO513vmcbPqrdtpHfEHRX18AtPNZo2TOiu9G3g432VwjEH1qjfzBA+QJPrRxUL9hTL 8xHuI9RiX1La4No2jaCYHjcGcTH1wopj27XbtFKxnfOcg4dcl1cRKFzBW6YQiydJO62C NN9LAc0mNpLCKWD5P9SD488tymkipFpsSzrTGpnxVqYDqcjZ/G7Re4cV0T3zpSMt0a1M u/WnrHEYwbhK8R9jICbNp+syudmljT+p8F9EAtpuiWuKtmCu1RuzA+gz9UpFA5cEloCt 8G1Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id q23si189209wmj.107.2020.06.29.08.02.20; Mon, 29 Jun 2020 08:02:20 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7471468AB65; Mon, 29 Jun 2020 18:00:21 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 82FC568ACB2 for ; Mon, 29 Jun 2020 18:00:09 +0300 (EEST) IronPort-SDR: nTTxofRtahv8u5OeaAgjeKLKjkGr04Zs6eoMFQ7z7CDocltzNVm4iGMVSgnIivO5dbyzQQhrfR 02eP3igqJwDQ== X-IronPort-AV: E=McAfee;i="6000,8403,9666"; a="144173141" X-IronPort-AV: E=Sophos;i="5.75,295,1589266800"; d="scan'208";a="144173141" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2020 08:00:00 -0700 IronPort-SDR: dha3mp/qzk0wzLmFW9+ssU8tlG7qRz3gG9u+e6dbhLlAKb9vI1h9apvOjASgidTH9IUFVjsWfQ Do8VQstOVJPQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,295,1589266800"; d="scan'208";a="313069770" Received: from semmer-ubuntu.sh.intel.com ([10.239.159.54]) by fmsmga002.fm.intel.com with ESMTP; 29 Jun 2020 07:59:59 -0700 From: Ting Fu To: ffmpeg-devel@ffmpeg.org Date: Mon, 29 Jun 2020 22:54:07 +0800 Message-Id: <20200629145411.24005-8-ting.fu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200629145411.24005-1-ting.fu@intel.com> References: <20200629145411.24005-1-ting.fu@intel.com> Subject: [FFmpeg-devel] [PATCH V2 08/12] dnn-layer-math-unary-test: add unit test for asinh 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" X-TUID: /fDptNW5yPeH Content-Length: 1431 Signed-off-by: Ting Fu --- tests/dnn/dnn-layer-mathunary-test.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/dnn/dnn-layer-mathunary-test.c b/tests/dnn/dnn-layer-mathunary-test.c index 6885b4d318..90fce71a0c 100644 --- a/tests/dnn/dnn-layer-mathunary-test.c +++ b/tests/dnn/dnn-layer-mathunary-test.c @@ -50,6 +50,8 @@ static float get_expected(float f, DNNMathUnaryOperation op) return cosh(f); case DMUO_TANH: return tanh(f); + case DMUO_ASINH: + return asinh(f); default: av_assert0(!"not supported yet"); return 0.f; @@ -113,5 +115,7 @@ int main(int agrc, char **argv) return 1; if (test(DMUO_TANH)) return 1; + if (test(DMUO_ASINH)) + return 1; return 0; } From patchwork Mon Jun 29 14:54:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Fu, Ting" X-Patchwork-Id: 20710 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:80ca:0:0:0:0:0 with SMTP id c10csp2876901ybm; Mon, 29 Jun 2020 08:01:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpo+8A1T2b34CGvE0vmgrujZa6nrFWbF8z/Y8lcdsSoYeJUngRS9LuyBr0F6UeHXiD/Pnb X-Received: by 2002:adf:a51a:: with SMTP id i26mr17041121wrb.406.1593442880295; Mon, 29 Jun 2020 08:01:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593442880; cv=none; d=google.com; s=arc-20160816; b=YUkRw7GmEvHhPueroqLq/kGKHsqdVJALzM7VIiXBFh/iQrp6vkt8NbkozrpE1VPTVf A58U83De0RHyGYMRMgk3ZCZ17gxTO8wbVukIjf4cCB0857vwqAHvD1vnzgh5ZeFG/JOQ KnjNcKULodU6boJuW/tqUxC/A8/4tArfn/W8lJDvW6GM6hn9G8o489MExG6nS++oOJmY eejyCOAStwJcpqtXWRN8ogqFtBBcusDZe8vJkx/dttlyxlsBXbkAHL/A/2PGzz83lip0 DgW7wxE4S1HahW9XqYwpQnV7tO0w70ucp23a/Q7zQ7CwPS+bTFrtSIVBM5ZEXme0bgxM eDTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:ironport-sdr:ironport-sdr:delivered-to; bh=+eNxQBn9OdI+Uv0EZ1AzKIKu7tdAx2RKJDc+9n9QV80=; b=GAPjvCbvjM/tBihbZSyIy0woxi6Vqyf0wbTWnaRNjccTQcXdRvPFCW5/FEgaIvt29V K9PuQIYkE0TUk4R2UdaDC1lFdR3ZiMxeLGrh6qE/Px49IbYrJQkpBzAQ9uzkgzHV13eP qsf7NEwoSurmBxfNV9tqOYBr3A8JxtnVzrYLtLK/mDhdzr5+xXvL6vS6th1xk8PLBKQQ 5QjzF5io5S21hxrWA8d5368igQKPe2z0+PBKAqPjP3cAwb8T1eri2hCpG4XrkeMGVpYU Khf3IhI2lz7S9e+gyuPtEWpfLpTTllovwb26V98HZRlis7rulLFEBYm43attvkTGd3P3 xREQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id m127si160566wmf.205.2020.06.29.08.01.19; Mon, 29 Jun 2020 08:01:20 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E5D8C68AC48; Mon, 29 Jun 2020 18:00:14 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 09E1E68AAFB for ; Mon, 29 Jun 2020 18:00:10 +0300 (EEST) IronPort-SDR: 7ybMVyl27JajbxT3OlBKwYejRyVQO+GCT093/Yy6Aq+apCfgf1wHrbP88lkuPB8KK4WreBcmUk 5OYz1CvZxsvg== X-IronPort-AV: E=McAfee;i="6000,8403,9666"; a="144173143" X-IronPort-AV: E=Sophos;i="5.75,295,1589266800"; d="scan'208";a="144173143" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2020 08:00:01 -0700 IronPort-SDR: 5CxAXpjMLZlf/o/CCSmQf7UWmrKSyHjJnckkzFha+e1WbQhaGkaOvrzwacYzHH43Qju/yzkA1T o/LvjzJxoLkQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,295,1589266800"; d="scan'208";a="313069776" Received: from semmer-ubuntu.sh.intel.com ([10.239.159.54]) by fmsmga002.fm.intel.com with ESMTP; 29 Jun 2020 08:00:00 -0700 From: Ting Fu To: ffmpeg-devel@ffmpeg.org Date: Mon, 29 Jun 2020 22:54:08 +0800 Message-Id: <20200629145411.24005-9-ting.fu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200629145411.24005-1-ting.fu@intel.com> References: <20200629145411.24005-1-ting.fu@intel.com> Subject: [FFmpeg-devel] [PATCH V2 09/12] dnn_backend_native_layer_mathunary: add acosh support 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" X-TUID: r1R6AW3Wk+I1 Content-Length: 3956 Signed-off-by: Ting Fu --- libavfilter/dnn/dnn_backend_native_layer_mathunary.c | 4 ++++ libavfilter/dnn/dnn_backend_native_layer_mathunary.h | 1 + tools/python/convert_from_tensorflow.py | 2 +- tools/python/convert_header.py | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/libavfilter/dnn/dnn_backend_native_layer_mathunary.c b/libavfilter/dnn/dnn_backend_native_layer_mathunary.c index 83df98d0f8..b77b84a794 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_mathunary.c +++ b/libavfilter/dnn/dnn_backend_native_layer_mathunary.c @@ -120,6 +120,10 @@ int dnn_execute_layer_math_unary(DnnOperand *operands, const int32_t *input_oper for (int i = 0; i < dims_count; ++i) dst[i] = asinh(src[i]); return 0; + case DMUO_ACOSH: + for (int i = 0; i < dims_count; ++i) + dst[i] = acosh(src[i]); + return 0; default: return -1; } diff --git a/libavfilter/dnn/dnn_backend_native_layer_mathunary.h b/libavfilter/dnn/dnn_backend_native_layer_mathunary.h index fbe9af5c7d..eb30231549 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_mathunary.h +++ b/libavfilter/dnn/dnn_backend_native_layer_mathunary.h @@ -41,6 +41,7 @@ typedef enum { DMUO_COSH = 8, DMUO_TANH = 9, DMUO_ASINH = 10, + DMUO_ACOSH = 11, DMUO_COUNT } DNNMathUnaryOperation; diff --git a/tools/python/convert_from_tensorflow.py b/tools/python/convert_from_tensorflow.py index 0d756c8109..1e73e3aefe 100644 --- a/tools/python/convert_from_tensorflow.py +++ b/tools/python/convert_from_tensorflow.py @@ -72,7 +72,7 @@ class TFConverter: self.conv2d_scopename_inputname_dict = {} self.op2code = {'Conv2D':1, 'DepthToSpace':2, 'MirrorPad':3, 'Maximum':4, 'MathBinary':5, 'MathUnary':6} self.mathbin2code = {'Sub':0, 'Add':1, 'Mul':2, 'RealDiv':3, 'Minimum':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} + 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} self.mirrorpad_mode = {'CONSTANT':0, 'REFLECT':1, 'SYMMETRIC':2} self.name_operand_dict = {} diff --git a/tools/python/convert_header.py b/tools/python/convert_header.py index 3211c13f6d..8fc3438552 100644 --- a/tools/python/convert_header.py +++ b/tools/python/convert_header.py @@ -23,4 +23,4 @@ str = 'FFMPEGDNNNATIVE' major = 1 # increase minor when we don't have to re-convert the model file -minor = 16 +minor = 17 From patchwork Mon Jun 29 14:54:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Fu, Ting" X-Patchwork-Id: 20728 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:80ca:0:0:0:0:0 with SMTP id c10csp2877033ybm; Mon, 29 Jun 2020 08:01:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwTNPdIYCPiHKWccroZUFZfXmSZOogWSGBEhmV16N83hZFbwBvATMA3AjGDFxMvNwdemqp X-Received: by 2002:a5d:60d0:: with SMTP id x16mr17912567wrt.5.1593442888450; Mon, 29 Jun 2020 08:01:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593442888; cv=none; d=google.com; s=arc-20160816; b=BakJXr1EVfycd/aijPCPhpbgxZczgA0aYTfF0Jj7QwLW2PYbDiozTvP3oRXn/hQ1Cg WAzl5Jl3YoTCI7H7nMorhruK2NmeryP+51bElYVUq2y4njJv+oG+virDKEvmqVqvwbWe gEpNKWdJlrWDqlyKgwueS78cUf2+rWbXghNQUcZPdnF8jBBDjrSg6nr63+q38SMheaOj DLTxY1xibcF1JkF9+zY8OpTjQrXMQs5+JCMZ7rtJJMXPiN1InxL0BnSNQ9El4CiS9goO 3G1udr+In46dSgrOEk1a+YqbI7e4oQnjyl6e8CIsKnVbCWvzB6BnW8+3qMVPv3Vl07Gh azRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:ironport-sdr:ironport-sdr:delivered-to; bh=L3lxulMawCCeP0y+4a1kJWE5LfnhS0lKjVibMJ0ONq0=; b=G/sJvq/DOekbLEv0nggCgHNlpu13x1gX17PvcjJQ08dXutF7NRZD5tRfs8e3Unudot X1Yx/+qGK7cdEr7FXRaxtceGmwjODfJZE9sFzhR/Pyapii3OBjyIeHMpfUBOcJZedV3t bSrxud9C932HgVH0s2ZSWjlKYnv0hW7uBXcaiqtm7dpnti6qFTqk5Tro5ZDwpFJoIgyJ +rDr1N+1wrr7Kr1+8aQ5qEfleHLPV4tgjXfrarzxf12vPjjs+q6rl3v4jLFGETkWNeN5 UT/D7SXKfzSxwVpv97vHYLwoTUzc7sT2iubAcwKbaomQ8lUMoAA/yMAtzc8E1LnZiKwg kA1w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id b67si183406wmc.109.2020.06.29.08.01.28; Mon, 29 Jun 2020 08:01:28 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5BDB868ACB2; Mon, 29 Jun 2020 18:00:15 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E943F68AAAD for ; Mon, 29 Jun 2020 18:00:11 +0300 (EEST) IronPort-SDR: VshzJqd0HdekRz3WNZiRC/utYjgXeuyh8fTF17uxv4cr27aAWBhInL8Sn85JUkyHsrtxyvgElP sYcpMCY2o/lQ== X-IronPort-AV: E=McAfee;i="6000,8403,9666"; a="144173148" X-IronPort-AV: E=Sophos;i="5.75,295,1589266800"; d="scan'208";a="144173148" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2020 08:00:02 -0700 IronPort-SDR: WvCtyzA4K6wDrU1h+AT1eLqK4WVUimfpqIwPf8yWBXg7lXJLpKQCTlgkczVJjD0BR3fb2QP98U t9XmTZQp0c8Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,295,1589266800"; d="scan'208";a="313069785" Received: from semmer-ubuntu.sh.intel.com ([10.239.159.54]) by fmsmga002.fm.intel.com with ESMTP; 29 Jun 2020 08:00:01 -0700 From: Ting Fu To: ffmpeg-devel@ffmpeg.org Date: Mon, 29 Jun 2020 22:54:09 +0800 Message-Id: <20200629145411.24005-10-ting.fu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200629145411.24005-1-ting.fu@intel.com> References: <20200629145411.24005-1-ting.fu@intel.com> Subject: [FFmpeg-devel] [PATCH V2 10/12] dnn-layer-math-unary-test: add unit test for acosh 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" X-TUID: OrIxMD8sFyaQ Content-Length: 1435 Signed-off-by: Ting Fu --- tests/dnn/dnn-layer-mathunary-test.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/dnn/dnn-layer-mathunary-test.c b/tests/dnn/dnn-layer-mathunary-test.c index 90fce71a0c..5587e47ad5 100644 --- a/tests/dnn/dnn-layer-mathunary-test.c +++ b/tests/dnn/dnn-layer-mathunary-test.c @@ -52,6 +52,8 @@ static float get_expected(float f, DNNMathUnaryOperation op) return tanh(f); case DMUO_ASINH: return asinh(f); + case DMUO_ACOSH: + return acosh(f); default: av_assert0(!"not supported yet"); return 0.f; @@ -117,5 +119,7 @@ int main(int agrc, char **argv) return 1; if (test(DMUO_ASINH)) return 1; + if (test(DMUO_ACOSH)) + return 1; return 0; } From patchwork Mon Jun 29 14:54:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Fu, Ting" X-Patchwork-Id: 20720 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:80ca:0:0:0:0:0 with SMTP id c10csp2877443ybm; Mon, 29 Jun 2020 08:01:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9YgwKZ4UT2vCPuHFLe1aymrVHOebzYYuNjArs9vDhz/AXshmpcdxochf1k/1mS9gEtQPQ X-Received: by 2002:adf:f452:: with SMTP id f18mr17143747wrp.389.1593442916052; Mon, 29 Jun 2020 08:01:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593442916; cv=none; d=google.com; s=arc-20160816; b=OCnGP94DqJ4stVswpG3UxTSBJbA/ohEGKgZOkDM/vbHC2VXAQifdsFl3nZMJ3WDohw AJYHgwM+MgGUzuny8VVJ+ewvVvwbFlBZwrHtx6cRhPQqsAonfp7VHpM76Uqk6EoyeiJX 08zFbFiqL8JQUSsQG5G+XkxvBe1vUi3x951YRMvULv40eYVnD1HzqQSbhMPpaHRDG4T8 OxpgRD/ss72wk7Uy1nlurWQgvQVI3LQJ9jziOqlz1XXTAnTQ4Nq6wMD3Ke5q0ZLlVy6E ka1OqD0SLFi3YBD7sGSQK9gKqdQn/28DPCtosJw9XmzG/EF0cQko9bBstR3djicIagYW UPUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:ironport-sdr:ironport-sdr:delivered-to; bh=ePkitFRsvTfJQbikwP8S0tFErgHEb3okXHrITZLkXfk=; b=fbS+1t9lBeO1v6J33VVFRWg7ioHfSqnY8d0b6/ytKBjSFYhrzblBskwohONPR16xqR 7z06yToQdjsYpDoe22KcHxbzwE4sC9nmMdkNtXFs32iPO1sqesqVSb8WnZK077SQdvZC h/JKiEfFE+1lo+iGOmViidb46utPYCYkuHLAUfxP8UZECehpD240KPn/nQpyWOAaAyiK D1RKP9zL1U8eccpTD364H4MZQza3nUyeuUg+ym7IUgbwRk9Pghp+VTHgUtVtsVv+yZ29 e0hqRfFvNtqL1SLG7J239JPNzSczAv3zOk/mQkaGQoWSWo9slf7E3ZO6r41F/RqDvkJt mtwQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id r26si176234wra.116.2020.06.29.08.01.55; Mon, 29 Jun 2020 08:01:56 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B347568A427; Mon, 29 Jun 2020 18:00:19 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id ECD8168AABE for ; Mon, 29 Jun 2020 18:00:12 +0300 (EEST) IronPort-SDR: vi81ANYTcSMh+eMqtROlZSEayHhlgUqOYyzr/M1hodPHc3bqS9bfI243zzbgD7EqvbOfcU1/bL Gd7J6JXxXTlA== X-IronPort-AV: E=McAfee;i="6000,8403,9666"; a="144173152" X-IronPort-AV: E=Sophos;i="5.75,295,1589266800"; d="scan'208";a="144173152" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2020 08:00:03 -0700 IronPort-SDR: MMSftCdtG84dG2TLP1FYvrVs3p2XfAv66L8OVx0GSug4DA+2JLcZJ3Ki5DNob2wsPC7ziQb32f f+ipeeoXPUmw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,295,1589266800"; d="scan'208";a="313069810" Received: from semmer-ubuntu.sh.intel.com ([10.239.159.54]) by fmsmga002.fm.intel.com with ESMTP; 29 Jun 2020 08:00:02 -0700 From: Ting Fu To: ffmpeg-devel@ffmpeg.org Date: Mon, 29 Jun 2020 22:54:10 +0800 Message-Id: <20200629145411.24005-11-ting.fu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200629145411.24005-1-ting.fu@intel.com> References: <20200629145411.24005-1-ting.fu@intel.com> Subject: [FFmpeg-devel] [PATCH V2 11/12] dnn_backend_native_layer_mathunary: add atanh support 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" X-TUID: fQbOoTaf0D5I Content-Length: 5925 It can be tested with the model generated with below python script: import tensorflow as tf import numpy as np import imageio in_img = imageio.imread('input.jpeg') in_img = in_img.astype(np.float32)/255.0 in_data = in_img[np.newaxis, :] x = tf.placeholder(tf.float32, shape=[1, None, None, 3], name='dnn_in') please uncomment the part you want to test x_sinh_1 = tf.sinh(x) x_out = tf.divide(x_sinh_1, 1.176) # sinh(1.0) x_cosh_1 = tf.cosh(x) x_out = tf.divide(x_cosh_1, 1.55) # cosh(1.0) x_tanh_1 = tf.tanh(x) x__out = tf.divide(x_tanh_1, 0.77) # tanh(1.0) x_asinh_1 = tf.asinh(x) x_out = tf.divide(x_asinh_1, 0.89) # asinh(1.0/1.1) x_acosh_1 = tf.add(x, 1.1) x_acosh_2 = tf.acosh(x_acosh_1) # accept (1, inf) x_out = tf.divide(x_acosh_2, 1.4) # acosh(2.1) x_atanh_1 = tf.divide(x, 1.1) x_atanh_2 = tf.atanh(x_atanh_1) # accept (-1, 1) x_out = tf.divide(x_atanh_2, 1.55) # atanhh(1.0/1.1) y = tf.identity(x_out, name='dnn_out') #please only preserve the x_out you want to test sess=tf.Session() sess.run(tf.global_variables_initializer()) graph_def = tf.graph_util.convert_variables_to_constants(sess, sess.graph_def, ['dnn_out']) tf.train.write_graph(graph_def, '.', 'image_process.pb', as_text=False) print("image_process.pb generated, please use \ path_to_ffmpeg/tools/python/convert.py to generate image_process.model\n") output = sess.run(y, feed_dict={x: in_data}) imageio.imsave("out.jpg", np.squeeze(output)) Signed-off-by: Ting Fu --- libavfilter/dnn/dnn_backend_native_layer_mathunary.c | 4 ++++ libavfilter/dnn/dnn_backend_native_layer_mathunary.h | 1 + tools/python/convert_from_tensorflow.py | 2 +- tools/python/convert_header.py | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/libavfilter/dnn/dnn_backend_native_layer_mathunary.c b/libavfilter/dnn/dnn_backend_native_layer_mathunary.c index b77b84a794..c83d50db64 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_mathunary.c +++ b/libavfilter/dnn/dnn_backend_native_layer_mathunary.c @@ -124,6 +124,10 @@ int dnn_execute_layer_math_unary(DnnOperand *operands, const int32_t *input_oper for (int i = 0; i < dims_count; ++i) dst[i] = acosh(src[i]); return 0; + case DMUO_ATANH: + for (int i = 0; i < dims_count; ++i) + dst[i] = atanh(src[i]); + return 0; default: return -1; } diff --git a/libavfilter/dnn/dnn_backend_native_layer_mathunary.h b/libavfilter/dnn/dnn_backend_native_layer_mathunary.h index eb30231549..8076356ba4 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_mathunary.h +++ b/libavfilter/dnn/dnn_backend_native_layer_mathunary.h @@ -42,6 +42,7 @@ typedef enum { DMUO_TANH = 9, DMUO_ASINH = 10, DMUO_ACOSH = 11, + DMUO_ATANH = 12, DMUO_COUNT } DNNMathUnaryOperation; diff --git a/tools/python/convert_from_tensorflow.py b/tools/python/convert_from_tensorflow.py index 1e73e3aefe..85db7bf710 100644 --- a/tools/python/convert_from_tensorflow.py +++ b/tools/python/convert_from_tensorflow.py @@ -72,7 +72,7 @@ class TFConverter: self.conv2d_scopename_inputname_dict = {} self.op2code = {'Conv2D':1, 'DepthToSpace':2, 'MirrorPad':3, 'Maximum':4, 'MathBinary':5, 'MathUnary':6} self.mathbin2code = {'Sub':0, 'Add':1, 'Mul':2, 'RealDiv':3, 'Minimum':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, 'Acosh':11} + 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} self.mirrorpad_mode = {'CONSTANT':0, 'REFLECT':1, 'SYMMETRIC':2} self.name_operand_dict = {} diff --git a/tools/python/convert_header.py b/tools/python/convert_header.py index 8fc3438552..9851d84144 100644 --- a/tools/python/convert_header.py +++ b/tools/python/convert_header.py @@ -23,4 +23,4 @@ str = 'FFMPEGDNNNATIVE' major = 1 # increase minor when we don't have to re-convert the model file -minor = 17 +minor = 18 From patchwork Mon Jun 29 14:54:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Fu, Ting" X-Patchwork-Id: 20718 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:80ca:0:0:0:0:0 with SMTP id c10csp2877578ybm; Mon, 29 Jun 2020 08:02:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyB6Z4iv/bwMojuDKLNj3gpolKQ1+hBXlElcSaAubZPnCdDvFjEQSRgK+iPamEY559vziZ/ X-Received: by 2002:a1c:5f45:: with SMTP id t66mr18003619wmb.144.1593442923864; Mon, 29 Jun 2020 08:02:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593442923; cv=none; d=google.com; s=arc-20160816; b=JQr0WMMw+GgPThacYfaNmr4jJoh3gY2ZNQWBWuex1yep7Sn9zj231b3MiKvM1wrmf0 aWIx34W9QKW2w1dnyzJgDi74yDphecuU4M0+k30dzCKWNQu5UYi78T/xRzK+1nE6TsS2 8L/1PZINelgJJOyxJypZO6UeOK54jhOCbJ6KEGjoJF0LMlvPGYFCU2WbHmeVVTNgfdTV 5tHMK2M8135WiQr9jnrYU97gUesCwqo9PvUw6Gevxdlz44FS4bV0bmkGoL7nFI3h6Nqc hciAIWHaLG5OA34BBKwhPYeArjWRHLIg3/JRPWG6KkZPi1sOkCsbJ/64gtDy7iZAZGQB K60w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:ironport-sdr:ironport-sdr:delivered-to; bh=WnfCXrP3zrh+tjgU81F9OMd/DMMDj4UPIefHcclwfrc=; b=AO0nxcqQeg97oI8ymf5/CS9DjMJsb34skIzwfwxEOTiuyyaPJmXb0CHC9BCuBS8+vg qaGYKnycaJLRTE93+HoUDr+S4MIpBy4dvtcVm6ZUO31TXAetMLUKzpBwqFUQigi6rm8k y/MDc23PZpAspXCRaA9kRlh0haFYfV08+mO78Rt7LWQc+DC+PsiXxK8L6sIXrI5PidyL XRkJsByuZAi/fdnXLkMq8Njmjl9flCcFpZFTQfF1odAfk/OdF241FGiaONdqnDkffqKD cqVsO1YapnkxnIPU+TD7gk+sl2TV9LMLHblaEGozbJiGKKOqcuDRP/iJAjFF/hFbCzXl tKhw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id y202si203197wmc.41.2020.06.29.08.02.03; Mon, 29 Jun 2020 08:02:03 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 277E068AEC0; Mon, 29 Jun 2020 18:00:20 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 043C168AC48 for ; Mon, 29 Jun 2020 18:00:13 +0300 (EEST) IronPort-SDR: oRplQK6MuqM/kvboYswsBFXY2c+nHOvWy3a3ysdIm0c5El/dQ+IsbHDv6pvmc2BIDcltLVJxPQ AbNi6cfJbbDg== X-IronPort-AV: E=McAfee;i="6000,8403,9666"; a="144173156" X-IronPort-AV: E=Sophos;i="5.75,295,1589266800"; d="scan'208";a="144173156" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2020 08:00:03 -0700 IronPort-SDR: j4s+sPl5ESiN3mZyjRWnP1bBcXj5Cw+bOanGV2Q/s2zMJ0ylDg45YgMKUXm/h1iTKbLp1RXSch Mh8egnb9+s7g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,295,1589266800"; d="scan'208";a="313069834" Received: from semmer-ubuntu.sh.intel.com ([10.239.159.54]) by fmsmga002.fm.intel.com with ESMTP; 29 Jun 2020 08:00:03 -0700 From: Ting Fu To: ffmpeg-devel@ffmpeg.org Date: Mon, 29 Jun 2020 22:54:11 +0800 Message-Id: <20200629145411.24005-12-ting.fu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200629145411.24005-1-ting.fu@intel.com> References: <20200629145411.24005-1-ting.fu@intel.com> Subject: [FFmpeg-devel] [PATCH V2 12/12] dnn-layer-math-unary-test: add unit test for atanh 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" X-TUID: ya+dyOsOCY7A Content-Length: 2315 Signed-off-by: Ting Fu --- 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; }