You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by ma...@apache.org on 2022/04/18 04:49:45 UTC

[tvm] branch main updated: [Frontend][Paddle] Fix pool2d op (#11029)

This is an automated email from the ASF dual-hosted git repository.

masahi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new 9f3da1cbae [Frontend][Paddle] Fix pool2d op (#11029)
9f3da1cbae is described below

commit 9f3da1cbae9ce16d14fbcd7b7804eeb9a16428e1
Author: chengruichang <52...@users.noreply.github.com>
AuthorDate: Mon Apr 18 12:49:41 2022 +0800

    [Frontend][Paddle] Fix pool2d op (#11029)
    
    * fix pool2d op
    
    * [frontend][Paddle] Fix pool2d Op
    
    * reformat files
---
 python/tvm/relay/frontend/paddlepaddle.py | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/python/tvm/relay/frontend/paddlepaddle.py b/python/tvm/relay/frontend/paddlepaddle.py
index d85f98a847..7f2460d66e 100644
--- a/python/tvm/relay/frontend/paddlepaddle.py
+++ b/python/tvm/relay/frontend/paddlepaddle.py
@@ -1231,9 +1231,17 @@ def convert_pool2d(g, op, block):
     # handle with special case
     # while kernel size less than input size
     # shrink kernel size to input size
-    if not isinstance(in_h, _op.Expr) and in_h < ksize[0]:
+    if (
+        not isinstance(in_h, _op.Expr)
+        and padding_algorithm == "EXPLICIT"
+        and in_h + paddings[0] + paddings[2] < ksize[0]
+    ):
         ksize[0] = in_h
-    if not isinstance(in_w, _op.Expr) and in_w < ksize[1]:
+    if (
+        not isinstance(in_w, _op.Expr)
+        and padding_algorithm == "EXPLICIT"
+        and in_w + paddings[1] + paddings[3] < ksize[1]
+    ):
         ksize[1] = in_w
 
     if not adaptive: