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

pytorch bug? #1250

Closed
lzmchina opened this issue Oct 26, 2022 · 5 comments
Closed

pytorch bug? #1250

lzmchina opened this issue Oct 26, 2022 · 5 comments
Assignees
Labels

Comments

@lzmchina
Copy link

lzmchina commented Oct 26, 2022

I want to use adaptive_avg_pool2d function to transform input tensor to output tensor:

output = adaptive_avg_pool2d(input, new LongArrayRef(new long[] { 7, 7 }, 2));

The input variable's shape is [64, 512, 7, 7], but the output's shape is [64, 512, 0, 7].

The correct output shape should be [64, 512, 7, 7]

@lzmchina lzmchina changed the title pytorch bug?x = adaptive_avg_pool2d(x, new LongArrayRef(new long[] { 7, 7 }, 2)); pytorch bug? Oct 26, 2022
@saudet
Copy link
Member

saudet commented Oct 26, 2022

You're probably not calling the function you want to call. Try to call the one with AdaptiveAvgPool2dOptions as parameter.

@lzmchina
Copy link
Author

You're probably not calling the function you want to call. Try to call the one with AdaptiveAvgPool2dOptions as parameter.

I have tried it at the first, but I still got a wrong shape tensor.

@saudet
Copy link
Member

saudet commented Oct 27, 2022

If you have a working example in C++, please provide it. It should be easy to translate it to Java.

@saudet
Copy link
Member

saudet commented Oct 29, 2022

Ah, I see what's wrong. We need an array of LongOptional for this. I've pushed a fix in commit 94268bb, and it's a bit awkward, but it works this way:

LongOptionalVector size = new LongOptionalVector(new LongOptional(7), new LongOptional(7));
Tensor output = adaptive_avg_pool2d(input, size.get(0));

Thanks for reporting!

@saudet
Copy link
Member

saudet commented Nov 3, 2022

The fix for this has been released with version 1.5.8! Enjoy

@saudet saudet closed this as completed Nov 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants