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

AvgPool2d's padding working incorrectly #478

Open
kwmaeng91 opened this issue Jun 25, 2023 · 0 comments
Open

AvgPool2d's padding working incorrectly #478

kwmaeng91 opened this issue Jun 25, 2023 · 0 comments

Comments

@kwmaeng91
Copy link

For some reason, AvgPool2d's padding works incorrectly.
Below is the minimal example to reproduce:

crypten.init()
x = torch.rand([16, 3, 128, 128])
x_enc = crypten.cryptensor(x, src=0)
model = nn.AvgPool2d(kernel_size=3, stride=2, padding=1)
print(model(x).shape)
model_enc = crypten.nn.from_pytorch(model, dummy_input=(x))
model_enc.encrypt()
print(model_enc(x_enc).shape)

The first print prints (16, 3, 64, 64). However, the second print (with Crypten) produces (18, 3, 64, 63). It is padding the first (batch) dimension instead of the last.

I tracked it down a little bit, and found that in _ConstantPad function, input[1] is being given as (0, 0, 1, 1, 0, 0, 1, 1), where it should be (1, 1, 1, 1). Not sure why.

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

No branches or pull requests

1 participant