From 2e473f23df4189b2e04bc81bbbbfd2765743f98a Mon Sep 17 00:00:00 2001 From: littletomatodonkey Date: Sun, 26 Sep 2021 15:09:13 +0800 Subject: [PATCH] fix pad tuple (#36043) * fix pad tuple * fix format --- python/paddle/nn/functional/common.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/paddle/nn/functional/common.py b/python/paddle/nn/functional/common.py index fcfbea438d..fdd370d7f8 100644 --- a/python/paddle/nn/functional/common.py +++ b/python/paddle/nn/functional/common.py @@ -1274,7 +1274,8 @@ def pad(x, pad, mode='constant', value=0, data_format="NCHW", name=None): x_dim = len(x.shape) - if mode == "constant" and isinstance(pad, list) and len(pad) == x_dim * 2: + if mode == "constant" and isinstance(pad, ( + list, tuple)) and len(pad) == x_dim * 2: return layers.pad(x, pad, pad_value=value) assert x_dim in [ -- GitLab