HI @seyeeet
First, if T=torch.tensor([20,30,40,10]) then A[:,:,T[2]:T[3]] won’t give you anything, because 10 is less then 40. Thus I propose to use cumsum first to get torch.tensor([20,50,90,100])
Second, you can use the resulting tensor as the index tensor for the A. But you still will need a loop to get A[T[i]] because the slices will be of different 3d sizes
Btw, I don’t exclude it that there’s a possibility to create 4d tensor that when apply mean(axis=3) would give what you’re looking for