torch / torch7

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

Unexpected result for max,min #1001

Closed zhixinwang closed 7 years ago

zhixinwang commented 7 years ago
th> x=torch.rand(3,4)
th> x
 0.9382  0.0923  0.7964  0.5702
 0.7325  0.1997  0.7330  0.3008
 0.4828  0.4719  0.4796  0.2431
[torch.DoubleTensor of size 3x4]
th> y=x:select(2,2)
th> value,idx=torch.max(y,1)
th> value
 0.4719
[torch.DoubleTensor of size 1]
th> idx
 1
[torch.LongTensor of size 1]

If the tensor is not contiguous,the "max" operation cannot get a right result for "index",the same problem as "min" operation. The problem can be found in the torch7 distribution version 2f95bf3. The old version may not have this problem.

soumith commented 7 years ago

i'm failing to reproduce this on torch7 master. Can you run: luarocks install torch and see if that fixes it?

zhixinwang commented 7 years ago

Thanks for fixing in time. Install the new version has solved this problem. The problem happened in the torch distribution version 2f95bf3 and corresponding torch7 version ac3751c.