List or Tensor? when feeding data to a module

I have used tensorflow at first, but then I start to use pytorch. In tf, the model only accepts tensors through the placeholder, but in pytorch, we can give data in any format to the forward function.

So I have a question. Does the list as an argument really works, based on the backwards?

Supposing I want the model to select some special vectors in a matrix, which will work?

  1. m(torch.tensor shape=mxn) index(list)
    m =[m[i] for i in index])
  2. m(torch.tensor shape=mxn) index(torch.tensor 1 demension)
    m =[index[i]] for i in range(index.shape[0]))

both code will work.