So given a  torch tensor of a given shape say ([1, 1, 10, 11, 12]) and another torch tensor created as:
rng = torch.tensor([9, 10, 11])

Now, I want to use this range over the last 3 dimensions. So something which statically would be equivalant to:
x = torch.rand(1, 1, 10, 11, 12)
rng = torch.tensor([9, 10, 11])

# statically want something like:

x[:, :, :rng[0], :rng[1], :rng[2]]

However, the dimension of the input tensor is dynamic  and I wonder if there is a way to do this kind  of indexing dynamically using torch? Otherwise, I have to basically hard code the input dimensions which is ugly and difficult to maintain.