code: def bbox2distance(
      points: Tensor,
      bbox: Tensor,
      max_dis: Optional[float] = None,
      eps: float = 0.1,
  ) -> Tensor:
      """Decode bounding box based on distances.
  
      Args:
          points (Tensor): Shape (n, 2) or (b, n, 2), [x, y].
          bbox (Tensor): Shape (n, 4) or (b, n, 4), "xyxy" format
          max_dis (float, optional): Upper bound of the distance.
          eps (float): a small value to ensure target < max_dis, instead <=
  
      Returns:
          Tensor: Decoded distances.
      """
      left = points[..., 0] - bbox[..., 0]
      top = points[..., 1] - bbox[..., 1]
      right = bbox[..., 2] - points[..., 0]
      bottom = bbox[..., 3] - points[..., 1]
      if max_dis is not None:
          left = left.clamp(min=0, max=max_dis - eps)
          top = top.clamp(min=0, max=max_dis - eps)
          right = right.clamp(min=0, max=max_dis - eps)
          bottom = bottom.clamp(min=0, max=max_dis - eps)
      return torch.stack([left, top, right, bottom], -1)
  
imports: from typing import List, Optional, Sequence, Tuple, Union
  import numpy
  import torch
  from torch import Tensor
  from mmdet.structures.bbox import BaseBoxes
label_desc: Use image node_id 9 for calling a global function with example usage: bbox2distance(points, bbox, max_dis, eps) and returns: torch