code: def is_close_gt(anchor, gt, stride_lst, max_dist=2.0, alpha=2.0):
      """Calculate distance ratio of box1 and box2 in batch for larger stride
          anchors dist/stride to promote the survive of large distance match
      Args:
          anchor (Tensor): box with the shape [L, 2]
          gt (Tensor): box with the shape [N, M2, 4]
      Return:
          dist (Tensor): dist ratio between box1 and box2 with the shape [N, M1, M2]
      """
      center1 = anchor.unsqueeze(0)
      center2 = (gt[..., :2] + gt[..., -2:]) / 2.0
      center1 = center1.unsqueeze(1)  # [N, M1, 2] -> [N, 1, M1, 2]
      center2 = center2.unsqueeze(2)  # [N, M2, 2] -> [N, M2, 1, 2]
  
      stride = (
          paddle.concat(
              [
                  paddle.full([x], 32 / pow(2, idx))
                  for idx, x in enumerate(stride_lst)
              ]
          )
          .unsqueeze(0)
          .unsqueeze(0)
      )
      dist = (
          paddle.linalg.norm(center1 - center2, p=2, axis=-1) / stride
      )
      dist_ratio = dist
      dist_ratio[dist < max_dist] = 1.0
      dist_ratio[dist >= max_dist] = 0.0
      return dist_ratio
  
file_path: PaddleDetection/ppdet/modeling/assigners/task_aligned_assigner.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from ppdet.core.workspace import register
  from ..bbox_utils import batch_iou_similarity
  from .utils import gather_topk_anchors, check_points_inside_bboxes, compute_max_iou_anchor
label_desc: Use image node_id 1 for calling a global function with example usage: is_close_gt(anchor, gt, stride_lst, max_dist, alpha) and returns: dist_ratio