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] add paddle.zeropad2d #36383

Closed
wants to merge 20 commits into from
Closed

[PaddlePaddle Hackathon] add paddle.zeropad2d #36383

wants to merge 20 commits into from

Conversation

justld
Copy link

@justld justld commented Oct 13, 2021

PR types

New features

PR changes

APIs

Describe

添加paddle.zeropad2d以及对应的测试案例

@CLAassistant
Copy link

CLAassistant commented Oct 13, 2021

CLA assistant check
All committers have signed the CLA.

@paddle-bot-old
Copy link

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@TCChenlong TCChenlong requested a review from zhiboniu October 20, 2021 07:56

def test_support_pad1(self):
"""
test the type of 'pad' is int.
Copy link
Contributor

Choose a reason for hiding this comment

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

int在上一个测例已经测过了,这里重复了吧

Args:
x(Tensor): The input tensor with data type float32/float64/int32/int64.
pad(Tensor | List[int] | Tuple[int]): The padding size with data type int.
The input dimension should be 3 and pad has the form (pad_left, pad_right,
Copy link
Contributor

Choose a reason for hiding this comment

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

dimension should be 3 与 后面不一致

.. code-block:: text
x = [[[[1., 2., 3.],
[4., 5., 6.]]]]
pad = [0, 0, 0, 0, 0, 0, 1, 1,]
Copy link
Contributor

Choose a reason for hiding this comment

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

这里与上面参数描述不一致


x_dim = len(x.shape)

assert x_dim == 4, "input tensor dimension should be 4, but got {}".format(
Copy link
Contributor

Choose a reason for hiding this comment

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

输入Tensor一定要是4维吗

@@ -79,6 +79,7 @@
from .tensor.creation import ones_like # noqa: F401
from .tensor.creation import zeros # noqa: F401
from .tensor.creation import zeros_like # noqa: F401
from .tensor.creation import zeropad2d # noqa: F401
Copy link
Contributor

Choose a reason for hiding this comment

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

需要添加到all列表中,另外需要实现paddle.nn.ZeroPad2d

@@ -381,6 +381,75 @@ def zeros_like(x, dtype=None, name=None):
return full_like(x=x, fill_value=0, dtype=dtype, name=name)


def zeropad2d(x, pad, data_format="NCHW", name=None):
"""
Pad tensor with 0 according to 'pad'.
Copy link
Contributor

@zhiboniu zhiboniu Oct 20, 2021

Choose a reason for hiding this comment

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

可以更详细一点,让别人看描述就知道用途甚至用法。
站在你自己看文档的角度,怎么描述可以让你更快速了解这个API是否是你需要的

@paddle-bot-old
Copy link

paddle-bot-old bot commented Nov 1, 2021

Sorry to inform you that 1ba8ea6's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually.

@TCChenlong
Copy link
Contributor

很多CI都挂了,需要解决一下哈上面同学的问题comments也最好回复一下哈

@justld justld closed this Nov 13, 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.

4 participants