class_docstr: Weighted loss of L2 distance with the pose angle for PFLD.
docstr: Calculate weighted L2 loss for PFLD.
  
  Parameters
  ----------
  landmark_gt : tensor
      the ground truth of landmarks
  euler_angle_gt : tensor
      the ground truth of pose angle
  angle : tensor
      the predicted pose angle
  landmarks : float32
      the predicted landmarks
  
  Returns
  -------
  output: tensor
      the weighted L2 loss
  output: tensor
      the normal L2 loss
docstr_tok: ["Calculate","weighted","L2","loss","for","PFLD",".","Parameters","--","--","--","--","--","landmark_gt",":","tensor","the","ground","truth","of","landmarks","euler_angle_gt",":","tensor","the","ground","truth","of","pose","angle","angle",":","tensor","the","predicted","pose","angle","landmarks",":","float32","the","predicted","landmarks","Returns","--","--","--","-","output",":","tensor","the","weighted","L2","loss","output",":","tensor","the","normal","L2","loss"]
code: def forward(self, landmark_gt, euler_angle_gt, angle, landmarks):
      """
      Calculate weighted L2 loss for PFLD.
  
      Parameters
      ----------
      landmark_gt : tensor
          the ground truth of landmarks
      euler_angle_gt : tensor
          the ground truth of pose angle
      angle : tensor
          the predicted pose angle
      landmarks : float32
          the predicted landmarks
  
      Returns
      -------
      output: tensor
          the weighted L2 loss
      output: tensor
          the normal L2 loss
      """
      weight_angle = torch.sum(
          1 - torch.cos(angle - euler_angle_gt), axis=1
      )
      l2_distant = torch.sum((landmark_gt - landmarks) ** 2, axis=1)
  
      return torch.mean(weight_angle * l2_distant), torch.mean(
          l2_distant
      )
  
file_path: nni/examples/nas/legacy/oneshot/pfld/lib/utils.py
imports: from __future__ import absolute_import, division, print_function
  import torch
  import numpy
  import torch.nn
label_desc: Use image node_id 2 for calling the PFLDLoss obj's underlying member method code with example usage: obj.forward(landmark_gt, euler_angle_gt, angle, landmarks) and returns: torch,  torch