code: def __call__(self, logits, targets):
      assert len(logits.shape) == 4, "logits should be 4-ndim"
      device = logits.device
      bs = logits.shape[0]
      # [num_kps, H, W] -> [B, num_kps, H, W]
      heatmaps = torch.stack([t["heatmap"].to(device) for t in targets])
      # [num_kps] -> [B, num_kps]
      kps_weights = torch.stack(
          [t["kps_weights"].to(device) for t in targets]
      )
  
      # [B, num_kps, H, W] -> [B, num_kps]
      loss = self.criterion(logits, heatmaps).mean(dim=[2, 3])
      loss = torch.sum(loss * kps_weights) / bs
      return loss
  
imports: import torch
label_desc: Use image node_id 2 for calling the KpLoss obj's underlying member method code with example usage: obj.__call__(logits, targets) and returns: loss