def loss(self,
             feats: Tuple[Tensor],
             batch_data_samples: OptSampleList,
             train_cfg: OptConfigType = {}) -> dict:
        """Calculate losses from a batch of inputs and data samples.

        Args:
            feats (Tuple[Tensor]): The multi-stage features
            batch_data_samples (List[:obj:`PoseDataSample`]): The batch
                data samples
            train_cfg (dict): The runtime config for training process.
                Defaults to {}

        Returns:
            dict: A dictionary of losses.
        """
        vis_pred_outputs = self.vis_forward(feats)
        vis_labels = torch.cat([
            d.gt_instance_labels.keypoint_weights for d in batch_data_samples
        ])

        # calculate vis losses
        losses = dict()
        loss_vis = self.loss_module(vis_pred_outputs, vis_labels)

        losses.update(loss_vis=loss_vis)

        # calculate vis accuracy
        acc_vis = self.vis_accuracy(vis_pred_outputs, vis_labels)
        losses.update(acc_vis=acc_vis)

        # calculate keypoints losses
        loss_kpt = self.pose_head.loss(feats, batch_data_samples)
        losses.update(loss_kpt)

        return losses
Calculate losses from a batch of inputs and data samples.

        Args:
            feats (Tuple[Tensor]): The multi-stage features
            batch_data_samples (List[:obj:`PoseDataSample`]): The batch
                data samples
            train_cfg (dict): The runtime config for training process.
                Defaults to {}

        Returns:
            dict: A dictionary of losses.
        
mmpose/mmpose/models/heads/hybrid_heads/vis_head.py