未验证 提交 0d32f554 编写于 作者: 张春乔 提交者: GitHub

fix the indexerror of conv2d_transpose (#50005)

上级 1755a154
......@@ -989,6 +989,17 @@ class TestConv2DTransposeOpException(unittest.TestCase):
self.assertRaises(ValueError, error_groups)
def error_0_filter_number():
out = paddle.static.nn.conv2d_transpose(
input=data,
groups=1,
num_filters=0,
filter_size=3,
data_format='NCHW',
)
self.assertRaises(ValueError, error_0_filter_number)
class TestConv2DTransposeRepr(unittest.TestCase):
def test_case(self):
......
......@@ -1542,6 +1542,9 @@ def conv2d_transpose(
"but received {}".format(len(input.shape))
)
if num_filters == 0:
raise ValueError("num of filters should not be 0.")
if data_format not in ['NCHW', 'NHWC']:
raise ValueError(
"Attr(data_format) of Op(paddle.static.nn.layers.conv2d_transpose) got wrong value: received "
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册