I have these 2 tensors
box_a = torch.randn(1,4)
box_b = torch.randn(1,4)
and i have a code in pytorch
box_a[:, 2:].unsqueeze(1).expand(1, 1, 2)
but i want to convert the above code in numpy
for box_a
and box_b
i can do something like this
box_a = numpy.random.randn(1,4)
box_b = numpy.random.randn(1,4)
But what about this
box_a[:, 2:].unsqueeze(1).expand(1, 1, 2)
solved it
box_a = np.random.randn(1,4)
box_b = np.random.randn(1,4)
max_xy = np.broadcast_to(np.expand_dims(box_a[:, 2:],axis=1),(1,1,2))