daiwx2002:

I want to accelerate multiplication of two numpy matrix X and Y on GPU, such as:
index=np.array([1,3,5,7])
X[index,:]*Y[index,:]
First, I transform torch.from_numpy(X).cuda(), torch.from_numpy(Y).cuda(),
But should the index of matrix also be transformed to torch.tensor like: torch.from_numpy(index).cuda() ?


docscippy seems to have just the thing