def forward(self, x):
    batch_size = x.size(0)
    backbone_outs = self.backbone(x)
    fpn_outs = self.fpn(backbone_outs['c3'], backbone_outs['c4'], backbone_outs['c5'])
    (class_pred, distance_pred, centerness_pred) = ([], [], [])
    for (idx, (distance_scale, fpn_out)) in enumerate(zip(self.distance_scales, fpn_outs.values())):
        head_out = self.polar_head(fpn_out)
        head_out['distance'] *= distance_scale
        head_out['distance'] = head_out['distance'].exp()
        class_pred.append(head_out['cls'].permute(0, 2, 3, 1).reshape(batch_size, (- 1), self.num_classes))
        distance_pred.append(head_out['distance'].permute(0, 2, 3, 1).reshape(batch_size, (- 1), 4))
        centerness_pred.append(head_out['centerness'].permute(0, 2, 3, 1).reshape(batch_size, (- 1)))
    class_pred = torch.cat(class_pred, dim=1)
    distance_pred = torch.cat(distance_pred, dim=1)
    centerness_pred = torch.cat(centerness_pred, dim=1)
    return (class_pred, distance_pred, centerness_pred)
def forward(self, x):
    batch_size = x.size(0)
    backbone_outs = self.backbone(x)
    fpn_outs = self.fpn(backbone_outs['c3'], backbone_outs['c4'], backbone_outs['c5'])
    (class_pred, distance_pred, centerness_pred) = ([], [], [])
    for (idx, (distance_scale, fpn_out)) in enumerate(zip(self.distance_scales, fpn_outs.values())):
        head_out = self.polar_head(fpn_out)
        head_out['distance'] *= distance_scale
        head_out['distance'] = head_out['distance'].exp()
        class_pred.append(head_out['cls'].permute(0, 2, 3, 1).reshape(batch_size, (- 1), self.num_classes))
        distance_pred.append(head_out['distance'].permute(0, 2, 3, 1).reshape(batch_size, (- 1), 4))
        centerness_pred.append(head_out['centerness'].permute(0, 2, 3, 1).reshape(batch_size, (- 1)))
    class_pred = torch.cat(class_pred, dim=1)
    distance_pred = torch.cat(distance_pred, dim=1)
    centerness_pred = torch.cat(centerness_pred, dim=1)
    return (class_pred, distance_pred, centerness_pred)