Suppose an nn.module model has some indexing work happen in forward():
def forward(self, data):
    # some indexing works, e.g.,:
    index = torch.randint(4, (4,))  # should I add index = index.cuda()?
    self.linear(data[:, index])
    ...

If this model is on GPU, for the best performance, should I also move index to cuda? Or it doesn’t matter? Why?