Okay, you’re right. The shapes are torch.Size([1, 450000, 4]), and torch.Size([1, 3]).
boxes1 are the anchor boxes, boxes2 the ground_truth boxes. So I followed it back to this line:
 label[:, 1:], anchors, device) in the multibox_target-function.
So I changed the line to:
           label[:, :], anchors, device) and the error is gone. Is that the right solution?
Then I have this new error: RuntimeError: The size of tensor a (4) must match the size of tensor b (2) at non-singleton dimension 3
because of this lines:
inter_upperlefts = torch.max(boxes1[:, None, :2], boxes2[:, :2])    
inter_lowerrights = torch.min(boxes1[:, None, 2:], boxes2[:, 2:]) 

boxes1 has 4 idx, boxes2 just 2. But I don’t know how exatly to change it that it makes sense.