According to PyTorch's implementation, you cannot directly call linears[ind] when ind is neither an int nor a slice.
linears[ind]
ind
int
slice
What you can do instead is:
out = input for idx in ind: out = linears[idx](out)