def METHOD_NAME(self):
    data = get_coco_sample(img_shape=(512, 512), num_instances=1)
    codec_cfg = dict(
        type='SPR',
        input_size=(512, 512),
        heatmap_size=(128, 128),
        sigma=(4, 2),
        generate_keypoint_heatmaps=True,
    )
    head = DEKRHead(
        in_channels=32,
        num_keypoints=17,
        decoder=codec_cfg,
        heatmap_loss=dict(type='KeypointMSELoss', use_target_weight=True),
        displacement_loss=dict(
            type='SoftWeightSmoothL1Loss',
            use_target_weight=True,
            supervise_empty=False,
            beta=1 / 9,
        ))
    encoded = head.decoder.encode(data['keypoints'],
                                  data['keypoints_visible'])
    feats = self._get_feats()
    data_samples = self._get_data_samples()
    for data_sample in data_samples:
        data_sample.gt_fields.set_data(
            {k: to_tensor(v)
             for k, v in encoded.items()})
    losses = head.loss(feats, data_samples)
    self.assertIn('loss/heatmap', losses)
    self.assertEqual(losses['loss/heatmap'].ndim, 0)
    self.assertIn('loss/displacement', losses)
    self.assertEqual(losses['loss/displacement'].ndim, 0)