code: def cal_loss(self, y_hat, y, hm=False):
      bs = y.size(0)
      y_hat = y_hat.view((bs, -1, 3))
      loss = torch.abs(y_hat - y)  # (B,K,3)
      loss[:, :, 2] *= 0.5
      if hm:
          loss = torch.mean(loss, dim=(1, 2))  # (B,)
          loss, _ = torch.topk(loss, k=int(bs * 0.25), largest=True)
          # B = len(loss)
          # S = int(B*0.5)
          # loss, _ = torch.sort(loss, descending=True)
          # loss = loss[:S]
      loss = torch.mean(loss) * 20.0
      return loss
  
file_path: insightface/reconstruction/gaze/models.py
imports: import pytorch_lightning
  from pytorch_lightning.callbacks import ModelCheckpoint
  from pytorch_lightning.callbacks import LearningRateMonitor
  from pytorch_lightning.loggers import TensorBoardLogger
  import torch
  import torch.nn
  import timm
label_desc: Use image node_id 3 for calling the GazeModel obj's underlying member method code with example usage: obj.cal_loss(y_hat, y, hm) and returns: loss