I have tow tensor : Box[20,4] and Match[512] -->(0,1,2,6,9,20,19…)
I want to produce a subset of Box given the Match resulting in MatchedBox[512,4]
How to do that(with out for loop or a function)?
Thank you for your time.
Just use it directly. Example:
import torch
boxes = torch.rand(5, 4)
indices = torch.randint(0, 5, (10,))
print(boxes)
print(indices)
print(boxes[indices, :])
1 Like