The problem is rng can be dynamic, so it can be 1D, 2D, 3D or 4D. If I do this, I have to hard code the dimensions. i.e. something like:
if len(rng) == 1:
    ....
elif len(rng) ==  2:
   ...

Is there a way to do this indexing directly with the tensor object?