Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Python IndexError of case19: paddle.nn.functional.conv2d_transpose #50006

Merged
merged 20 commits into from
Feb 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
8ef0f2b
修改linspace参数"stop"的介绍
longranger2 Dec 15, 2022
8137693
更新了conv2d_transpose英文文档中 1.公式异常 2.参数说明异常 3.padding=SAME和VALID的公式说明; t…
longranger2 Dec 15, 2022
f355003
Merge branch 'PaddlePaddle:develop' into develop
longranger2 Dec 16, 2022
5b92b78
解决了
longranger2 Dec 16, 2022
5b4f20e
更新了paddle.static.auc的英文文档的Return描述以及函数的参数
longranger2 Dec 16, 2022
370646c
Update python/paddle/tensor/creation.py
longranger2 Dec 16, 2022
009ee89
更新了shard_index的ignore_value描述
longranger2 Dec 16, 2022
3574b14
Merge remote-tracking branch 'origin/develop' into loneranger_paddle
longranger2 Dec 16, 2022
0603c66
修改了英文文档的paddle.static.nn.conv3d_transpose的公式介绍
longranger2 Dec 16, 2022
dc8be6d
add py_func COPY-FROM label; test=document_fix
Ligoml Dec 19, 2022
f25a731
Update python/paddle/tensor/manipulation.py
longranger2 Dec 19, 2022
968a848
formula; test=document_fix
Ligoml Dec 23, 2022
3d1b7a9
formula; test=document_fix
Ligoml Dec 23, 2022
18a171d
formula; test=document_fix
Ligoml Dec 23, 2022
3af6cf3
Merge branch 'PaddlePaddle:develop' into develop
longranger2 Jan 20, 2023
b96809f
为conv2d_transpose增加weight判断
longranger2 Jan 22, 2023
dc21bc1
Merge branch 'PaddlePaddle:develop' into conv2d_transpose
longranger2 Jan 31, 2023
ce558b5
为conv_2d_transpose添加单测
longranger2 Jan 31, 2023
7060026
Merge branch 'PaddlePaddle:develop' into conv2d_transpose
longranger2 Feb 1, 2023
578b06c
修改conv_2d_transpose单测的格式
longranger2 Feb 1, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions python/paddle/fluid/tests/unittests/test_conv2d_transpose_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,17 @@ def test_case(self):
paddle.enable_static()


class TestConv2dTranspose(unittest.TestCase):
def error_weight_input(self):
array = np.array([1], dtype=np.float32)
x = paddle.to_tensor(np.reshape(array, [1, 1, 1, 1]), dtype='float32')
weight = paddle.to_tensor(np.reshape(array, [1]), dtype='float32')
paddle.nn.functional.conv2d_transpose(x, weight, bias=0)

def test_type_error(self):
self.assertRaises(ValueError, self.error_weight_input)


class TestTensorOutputSize1(UnittestBase):
def init_info(self):
self.shapes = [[2, 3, 8, 8]]
Expand Down
6 changes: 6 additions & 0 deletions python/paddle/nn/functional/conv.py
Original file line number Diff line number Diff line change
Expand Up @@ -1204,6 +1204,12 @@ def conv2d_transpose(
x.shape
)
)
if len(weight.shape) != 4:
raise ValueError(
"Input weight should be 4D tensor, but received weight with the shape of {}".format(
weight.shape
)
)
num_channels = x.shape[channel_dim]
if num_channels < 0:
raise ValueError(
Expand Down