Selecting multiple channels on a specified dimension

Is there any function that takes a dimension a tuple/list of channels indices to pick and returns the the result same as the []-operator?

a= torch.arange(0,120).view(2,3,4,5)
print(a[:,(0,2),].size()) # torch.Size([2, 2, 4, 5])
print(a.select(1,(0,2))) # error int required
print(a.index_select(1, torch.LongTensor((0, 2))))
1 Like