-
Notifications
You must be signed in to change notification settings - Fork 751
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 the torch.sum() or tensor.sum() get the result shape is null! #1300
Comments
I don't think that's the version of sum() you want to use. Try the one taking an OptionalIntArrayRef instead. |
Each time you call a constructor of a subclass of |
in old pytorch-java version I can use sum(1) , but now the sum() method has change the input parameter type.
using sum(1) can not compile the process, and in my process sum() and x.sum(new OptionalIntArrayRef(1)) also can not get correct result , meet the error
|
Sounds like you want the ScalarTypeOptional variant? |
I do not understand your meaning, I do not care the ScalarTypeOptional use in torch.sum(), I just want to use like python
torch.sum(x,dim=1), how to write the java/scala code do that use javacpp-pytorch and really work get correctly result |
I think javacpp-pytorch should write some example like mnist ,tell the user how to correctly use the torch.sum and so on torch.nn.functional, and EmbeddingImpl layer these often use |
I'm guessing something like
Sure, like I keep telling you, contributions are welcome! |
As explained above, |
Or rather |
thanks,but for torch.sum also can not get correctly result I write code is here
I think could you try to debug the torch.sum() in javacpp-pytorch in version 1.13.0-1.5.9-SNAPSHOT , in old version Tensor.sum(long...) is very easy to use ,why in new version these declare parameter not contain in new version |
I don't know why, you should ask upstream about that. It's probably already explained in the issues somewhere there: In any case, if I understand the docs correctly, |
I has run the process as your code example wrote with 1.13.1-1.5.9-SNAPSHOT, but not correct effect for the sum dim,feel confused ,if the second parameter could represent the dim selected?
get the console error
|
if use DimnameArrayRef also get error wrote with 1.13.1-1.5.9-SNAPSHOT,
the console error
|
Right, this isn't going to work either. I've fixed it in commit 988101d so that |
thanks, but these update in which version? 1.13.1-1.5.9-SNAPSHOT ? 1.13.2-1.5.9-SNAPSHOT no exist |
If you're relying on the snapshots, make sure to update your cache |
Now the torch.sum() can corectly work,thanks |
HI ,when I want to invoke the sum method to compute sum of tensor , but can not get the correct shape, and the shape is null,I don't know why
system : macos intel
jdk 15 8
scala 2.12.11
pytorch version: 1.13.0-1.5.9-SNAPSHOT
in console
in old pytorch-javacpp version, I remember the sum maybe can really work, why new version get the bad result ,is DimnameArrayRef class I use it with false operate?
The text was updated successfully, but these errors were encountered: