def METHOD_NAME(self, batch_inputs: Tensor,
         batch_data_samples: SampleList) -> Union[dict, list]:
    """Calculate losses from a batch of inputs and data samples.
    Args:
        batch_inputs (Tensor): Input images of shape (N, C, H, W).
            These should usually be mean centered and std scaled.
        batch_data_samples (list[:obj:`DetDataSample`]): The batch
            data samples. It usually includes information such
            as `gt_instance` or `gt_panoptic_seg` or `gt_sem_seg`.
    Returns:
        dict: A dictionary of loss components.
    """
    outs = self._forward(batch_inputs)
    (batch_gt_instances, batch_gt_instances_ignore,
     batch_img_metas) = unpack_gt_instances(batch_data_samples)
    losses = self.criterion(outs, batch_gt_instances, batch_img_metas,
                            batch_gt_instances_ignore)
    return losses