You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1 2 3
7 8 9
[ CPUDoubleType{2,3} ]
1
9
[ CPUDoubleType{2} ]
terminate called after throwing an instance of 'c10::IndexError'
what(): too many indices for tensor of dimension 0
i.e. c10::ArrayRefat::indexing::TensorIndex gives {H[0][0], H[2][2]} instead of desirable H[[0,2], [0,2]], while call torch.index twice always acts on dimension 0
The text was updated successfully, but these errors were encountered:
tensor.index works fine with vectors, but thing gets weird for matrix and higher order tensors. An example is:
#include
#include <torch/torch.h>
int main() {
at::Tensor H = at::tensor({1.0, 2.0, 3.0,
4.0, 5.0, 6.0,
7.0, 8.0, 9.0});
H.resize_({3, 3});
}
Whose output is:
1 2 3
7 8 9
[ CPUDoubleType{2,3} ]
1
9
[ CPUDoubleType{2} ]
terminate called after throwing an instance of 'c10::IndexError'
what(): too many indices for tensor of dimension 0
i.e. c10::ArrayRefat::indexing::TensorIndex gives {H[0][0], H[2][2]} instead of desirable H[[0,2], [0,2]], while call torch.index twice always acts on dimension 0
The text was updated successfully, but these errors were encountered: