torch / torch7

http://torch.ch
Other
8.97k stars 2.38k forks source link

In-place index(...) returns a wrongly-sized tensor #974

Open vadimkantorov opened 7 years ago

vadimkantorov commented 7 years ago
a = torch.Tensor(10, 5):uniform()
print(a:index(1, torch.LongTensor{2, 4}):size())
print(torch.Tensor():index(a, 1, torch.LongTensor{2, 4}):size())

-- 2
-- 5
--[torch.LongStorage of size 2]

-- 2
--[torch.LongStorage of size 1]

Is this difference expected behavior? If so, I couldn't find a notice in docs.