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

add ReflectionPad2d #5172

Merged
merged 8 commits into from Jun 18, 2021
Merged

add ReflectionPad2d #5172

merged 8 commits into from Jun 18, 2021

Conversation

fwu11
Copy link
Contributor

@fwu11 fwu11 commented Jun 11, 2021

add ReflectionPad2d

doctest
图片

docstring
图片

unittest
图片

@CLAassistant
Copy link

CLAassistant commented Jun 11, 2021

CLA assistant check
All committers have signed the CLA.


def forward(self, x):
H, W = x.shape[2], x.shape[3]
if self.padding[2] < H and self.padding[3] < H and self.padding[0] < W and self.padding[1] < W:
Copy link
Contributor

Choose a reason for hiding this comment

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

你这个对padding_size的限制有出处吗,看了一下和pytorch没对齐。具体可以看:https://pytorch.org/docs/stable/nn.functional.html#torch.nn.functional.pad

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[2] < H and padding[3] < H and padding[0] < W and padding[1] < W

Copy link
Contributor

Choose a reason for hiding this comment

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

嗯,这个限制是没问题的,torch的op在c++层也做了同样的检查,不符合会报错的

.Input("x")
.Output("y")
.Attr("padding", boundary)
.Attr("floating_value", float(1.))
Copy link
Contributor

Choose a reason for hiding this comment

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

此op没有floating_value 、integral_value属性、不需要加

Copy link
Contributor Author

Choose a reason for hiding this comment

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

目前这个op不传这两个属性会报错。因为C++端op里面有这三个属性。

REGISTER_USER_OP(pad_2d_type) \

@oneflow-ci-bot oneflow-ci-bot self-requested a review June 18, 2021 01:12
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot June 18, 2021 03:41
@oneflow-ci-bot oneflow-ci-bot merged commit e3872b3 into master Jun 18, 2021
@oneflow-ci-bot oneflow-ci-bot deleted the zjfwu11 branch June 18, 2021 04:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants