pytorch / extension-cpp

C++ extensions in PyTorch
1.02k stars 214 forks source link

Issues with using scatter. #28

Closed kris-singh closed 5 years ago

kris-singh commented 5 years ago

Here is the gist of my code, along with the error in the comments. https://gist.github.com/kris-singh/ce5fbdb8aa242ed3357d27c3e8fdea5f I tried to debug the issue using lldb. I found that for the *this, src and index tensors all variables numel are correct. But when trying to get their sizes() it shows 1. I don't really understand why this is happening. Also in the error message should tell which tensor was half constructed. When submitting a bug report, please include the following information (where relevant):

Also, an unrelated not do you know how I could get code completion and definition look. Right now I have to ag search the aten directory for finding what I want to use.

soumith commented 5 years ago

use the torch:: namespace, not at::.

I modified your snippet to just use torch:: and fix some compile errors. https://gist.github.com/soumith/af07e5cf66174566d56c07bd983bcd89

The actual reason for error is now clearly spit out.

terminate called after throwing an instance of 'c10::Error'
  what():  a Tensor with 6000 elements cannot be converted to Scalar