I am trying to set several positions of an array in PyTorch for CUDA but the result is different from analogue operation in Numpy. Please see posted code.
As an illustration, I have a 1D array c and want to set it’s i positions to the values of r. E.g. if  c = [3, 4 , 5, 6], i = [1,3], r = [10, 11]  I do  c[i]=r and c becomes  c=[3,10,5,11].
While this works fine for small arrays in PyTorch CUDA, it can be incorrect for large arrays. Please see posted code. The CUDA result is different from Numpy result. It shouldn’t.
import torch
import numpy as np
print("Numpy version", np.__version__)
print("Troch version", torch.__version__)
print("Torch cuda version", torch.version.cuda)
np.random.seed(0)
c = np.random.randint(10000, size=100000, dtype='l')
i = np.random.randint(c.shape[0], size=10000, dtype='l')
s = np.random.randint(10000, size=10000, dtype='l')
c_gpu = torch.cuda.LongTensor(c)
i_gpu = torch.cuda.LongTensor(i)
s_gpu = torch.cuda.LongTensor(s)
c[i]=s
c_gpu[i_gpu]=s_gpu
print(np.sum(c != c_gpu.cpu().data.numpy()))

Actual output:
Numpy version 1.16.3
Troch version 1.1.0
Torch cuda version 10.0.130
208

Of course in every execution I got a different number 208, 225, 301 where the expected output always is zero.
Any idea why? Is this a bug, or am I missing something? Any help appreciated. Thank you.