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

【PaddlePaddle Hackathon】49. Add test of paddle.nn.functional.conv2d transpose #251

Conversation

OccupyMars2025
Copy link
Contributor

@OccupyMars2025 OccupyMars2025 commented Oct 16, 2021

PR types
New features

PR changes
add framework/api/nn/test_functional_conv2d_transpose.py

Describe
Task: PaddlePaddle/Paddle#35956
add pytest of paddle.nn.functional.conv2d_transpose

@OccupyMars2025 OccupyMars2025 changed the title Add test of paddle.nn.functional.conv2d transpose 【PaddlePaddle Hackathon】49 Add test of paddle.nn.functional.conv2d transpose Oct 16, 2021
@OccupyMars2025 OccupyMars2025 changed the title 【PaddlePaddle Hackathon】49 Add test of paddle.nn.functional.conv2d transpose 【PaddlePaddle Hackathon】49. Add test of paddle.nn.functional.conv2d transpose Oct 16, 2021
kolinwei
kolinwei previously approved these changes Oct 21, 2021
groups=groups,
output_size=None,
data_format="NHWC",
)
Copy link
Collaborator

@kolinwei kolinwei Oct 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要增加一些异常输入类的case,比如某个参数的值不在规定范围内

Copy link
Contributor Author

@OccupyMars2025 OccupyMars2025 Oct 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的,收到。我增加了两个obj.exception的异常输入类的case

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kolinwei
kolinwei previously approved these changes Oct 27, 2021
"""
implement
"""
self.types = [np.float32]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

验证下float16,和float64下的功能

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在float16下会报错,如下所示:
E RuntimeError: (NotFound) Operator conv2d_transpose does not have kernel for data_type[::paddle::platform::float16]:data_layout[ANY_LAYOUT]:place[CPUPlace]:library_type[PLAIN].
E [Hint: Expected kernel_iter != kernels.end(), but received kernel_iter == kernels.end().] (at C:\home\workspace\Paddle_release\paddle\fluid\imperative\prepared_operator.cc:135)
E [operator < conv2d_transpose > error]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在float64下可以测试通过

weight = np.full(shape=[in_channels, out_channels] + kernel_size, fill_value=3.3)
bias = np.full(shape=[out_channels], fill_value=-1.7)
stride = 1
padding = 1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

padding需要多测一下,可以参照文档中的描述:
padding (int|list|tuple|str,可选) - 填充大小。如果它是一个字符串,可以是"VALID"或者"SAME",表示填充算法,计算细节可参考上述 padding = "SAME"或 padding = "VALID" 时的计算公式。如果它是一个元组或列表,它可以有3种格式:(1)包含4个二元组:当 data_format 为"NCHW"时为 [[0,0], [0,0], [padding_height_top, padding_height_bottom], [padding_width_left, padding_width_right]],当 data_format 为"NHWC"时为[[0,0], [padding_height_top, padding_height_bottom], [padding_width_left, padding_width_right], [0,0]];(2)包含4个整数值:[padding_height_top, padding_height_bottom, padding_width_left, padding_width_right];(3)包含2个整数值:[padding_height, padding_width],此时padding_height_top = padding_height_bottom = padding_height, padding_width_left = padding_width_right = padding_width。若为一个整数,padding_height = padding_width = padding。默认值:0。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已增加更多关于padding的测试

add more test cases of the padding argument
@DDDivano DDDivano merged commit 605333c into PaddlePaddle:develop Oct 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants