Range-based indexing based on another tensor

Hi Desh!

You could also compute indices with a logical expression:

indices = torch.logical_and (torch.arange (T) >= t[:, :, 0:1], torch.arange (T) < 
t[:, :, 1:2])

To my eye, this version is a little more readable. (Because of broadcasting,
indices has the same shape as x.)

I don’t know whether this would have any efficiency benefits.

Best.

K. Frank