Get coordinates within bounding box

Given a tensor representing the bounding box of an object, I want to get all coordinates within the box without using a for loop. Is that possible.

For example for a
tensor A = [ [0,0, 3, 3], [0, 0, 2, 2] ] and so on where each entry is a bounding box of the form [xmin, ymin, xmax, ymax],

I want to convert it into a a tensor with values

[
[[0,0], [0,1], [0,2], [1,0], [1,1], [1,2], [2,0], [2,1], [2,2]],
[[0,0], [0,1], [1,0], [1,1],
]

where each row is set of all coordinate indexes in that bounding box

Karthik

I think you would still need one loop over the different bounding boxes:

bbox = [[0,0, 3, 3], [0, 0, 2, 2]]
for b in bbox:
    xv, yv = torch.meshgrid(torch.arange(b[0], b[2]), torch.arange(b[1], b[3]))
    print(torch.stack((xv, yv), dim=2).view(-1, 2))

Ya i was hoping there might be some arange function that operates on a tensor so that it picks begin and end values from 2 tensors and generates values between.