class_docstr: KptL1Cost.
  
  this function based on: https://github.com/hikvision-research/opera/blob/main/opera/core/bbox/match_costs/match_cost.py
  
  Args:
      weight (int | float, optional): loss_weight.
class_docstr_tok: ["KptL1Cost",".","this","function","based","on",":","https",":","\/\/github.com\/hikvision-research\/opera\/blob\/main\/opera\/core\/bbox\/match_costs\/match_cost.py","Args",":","weight","(","int","|","float",",","optional",")",":","loss_weight","."]
docstr: Args:
      kpt_pred (Tensor): Predicted keypoints with normalized coordinates
          (x_{i}, y_{i}), which are all in range [0, 1]. Shape
          [num_query, K, 2].
      gt_keypoints (Tensor): Ground truth keypoints with normalized
          coordinates (x_{i}, y_{i}). Shape [num_gt, K, 2].
      valid_kpt_flag (Tensor): valid flag of ground truth keypoints.
          Shape [num_gt, K].
  
  Returns:
      paddle.Tensor: kpt_cost value with weight.
docstr_tok: ["Args",":","kpt_pred","(","Tensor",")",":","Predicted","keypoints","with","normalized","coordinates","(","x_","{","i","}",",","y_","{","i","}",")",",","which","are","all","in","range","[","0",",","1","]",".","Shape","[","num_query",",","K",",","2","]",".","gt_keypoints","(","Tensor",")",":","Ground","truth","keypoints","with","normalized","coordinates","(","x_","{","i","}",",","y_","{","i","}",")",".","Shape","[","num_gt",",","K",",","2","]",".","valid_kpt_flag","(","Tensor",")",":","valid","flag","of","ground","truth","keypoints",".","Shape","[","num_gt",",","K","]",".","Returns",":","paddle.Tensor",":","kpt_cost","value","with","weight","."]
code: def __call__(self, kpt_pred, gt_keypoints, valid_kpt_flag):
      """
      Args:
          kpt_pred (Tensor): Predicted keypoints with normalized coordinates
              (x_{i}, y_{i}), which are all in range [0, 1]. Shape
              [num_query, K, 2].
          gt_keypoints (Tensor): Ground truth keypoints with normalized
              coordinates (x_{i}, y_{i}). Shape [num_gt, K, 2].
          valid_kpt_flag (Tensor): valid flag of ground truth keypoints.
              Shape [num_gt, K].
  
      Returns:
          paddle.Tensor: kpt_cost value with weight.
      """
      kpt_cost = []
      for i in range(len(gt_keypoints)):
          if gt_keypoints[i].size == 0:
              kpt_cost.append(kpt_pred.sum() * 0)
          kpt_pred_tmp = kpt_pred.clone()
          valid_flag = valid_kpt_flag[i] > 0
          valid_flag_expand = (
              valid_flag.unsqueeze(0)
              .unsqueeze(-1)
              .expand_as(kpt_pred_tmp)
          )
          if not valid_flag_expand.all():
              kpt_pred_tmp = masked_fill(
                  kpt_pred_tmp, ~valid_flag_expand, 0
              )
          cost = F.pairwise_distance(
              kpt_pred_tmp.reshape((kpt_pred_tmp.shape[0], -1)),
              gt_keypoints[i].reshape((-1,)).unsqueeze(0),
              p=1,
              keepdim=True,
          )
          avg_factor = paddle.clip(
              valid_flag.astype("float32").sum() * 2, 1.0
          )
          cost = cost / avg_factor
          kpt_cost.append(cost)
      kpt_cost = paddle.concat(kpt_cost, axis=1)
      return kpt_cost * self.weight
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  import paddle
  import paddle.nn.functional
  from ppdet.core.workspace import register
label_desc: Use image node_id 2 for calling the KptL1Cost obj's underlying member method code with example usage: obj.__call__(kpt_pred, gt_keypoints, valid_kpt_flag) and returns: unknown