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?
- m(torch.tensor shape=mxn) index(list)
m = torch.cat([m[i] for i in index])
- m(torch.tensor shape=mxn) index(torch.tensor 1 demension)
m = torch.cat(m[index[i]] for i in range(index.shape))