see the picture blow:
where x, inds are re created by
x=torch.rand(4, 2, 3)
, inds=torch.arange(4).view(4, 1, 1).expand(4, 2, 1)
respectively.however when I use
x.gather(2, inds)
, error occurred:RuntimeError: Invalid index in gather at /Users/soumith/b101_2/2019_02_08/wheel_build_dirs/wheel_3.7/pytorch/aten/src/TH/generic/THTensorEvenMoreMath.cpp:454
my environment is on macOS high sierra 10.13.6, with python3.7, torch 1.0.1.post2.
Besides, I have tried the 2 order tensor:
Is the tensor gathered must be a square?
And last, why the randint_like’s return still is torch.float type?
Thanks!