fermat97
(Pierre)
July 22, 2021, 2:27pm
1
Hi, I have two different machines both Ubuntu 18.04 with torch 1.9.0
and 1.9.0+cu102
. When I try the followings:
V = torch.tensor([[1,2,3],[4,5,6]])
idx = torch.tensor([0])
Now if I try:
print(V[idx])
I ll get different outputs:
tensor([[1, 2, 3]]) # for torch 1.9.0
tensor([1, 2, 3]) # for torch 1.9.0+cu102
Do you have any idea?
Assuming the difference between both installations would be a CPU-only vs. CUDA10.2 install, I cannot reproduce the issue and both pip wheels give tensor([[1, 2, 3]])
as the output using your code snippet.
fermat97
(Pierre)
July 23, 2021, 8:32am
3
@ptrblck this is very strange because the torch 1.9.0
is definitely using GPU.
Yes, that’s indeed strange, as I’ve installed the CPU and CUDA versions of 1.9.0
for this particular test and wasn’t able to reproduce it.
fermat97
(Pierre)
July 25, 2021, 1:56pm
5
The problem is my own code which hooks torch and somehow affects the __getitem__
functionality of torch.