class_docstr: This class encodes and decodes a set of bounding boxes into
  the representation used for training the regressors.
  
  Args:
      weights: 4-element tuple or 6-element tuple
      boxes_xform_clip: high threshold to prevent sending too large values into torch.exp()
  
  Example:
      .. code-block:: python
  
          box_coder = BoxCoder(weights=[1., 1., 1., 1., 1., 1.])
          gt_boxes = torch.tensor([[1,2,1,4,5,6],[1,3,2,7,8,9]])
          proposals = gt_boxes + torch.rand(gt_boxes.shape)
          rel_gt_boxes = box_coder.encode_single(gt_boxes, proposals)
          gt_back = box_coder.decode_single(rel_gt_boxes, proposals)
          # We expect gt_back to be equal to gt_boxes
docstr: Encode a set of proposals with respect to some ground truth (gt) boxes.
  
  Args:
      gt_boxes: list of gt boxes, Nx4 or Nx6 torch tensor. The box mode is assumed to be ``StandardMode``
      proposals: list of boxes to be encoded, each element is Mx4 or Mx6 torch tensor.
          The box mode is assumed to be ``StandardMode``
  
  Return:
      A tuple of encoded gt, target of box regression that is used to
          convert proposals into gt_boxes, Nx4 or Nx6 torch tensor.
docstr_tok: ["Encode","a","set","of","proposals","with","respect","to","some","ground","truth","(","gt",")","boxes",".","Args",":","gt_boxes",":","list","of","gt","boxes",",","Nx4","or","Nx6","torch","tensor",".","The","box","mode","is","assumed","to","be","``","StandardMode","``","proposals",":","list","of","boxes","to","be","encoded",",","each","element","is","Mx4","or","Mx6","torch","tensor",".","The","box","mode","is","assumed","to","be","``","StandardMode","``","Return",":","A","tuple","of","encoded","gt",",","target","of","box","regression","that","is","used","to","convert","proposals","into","gt_boxes",",","Nx4","or","Nx6","torch","tensor","."]
code: def encode(
      self, gt_boxes: Sequence[Tensor], proposals: Sequence[Tensor]
  ) -> tuple[Tensor]:
      """
      Encode a set of proposals with respect to some ground truth (gt) boxes.
  
      Args:
          gt_boxes: list of gt boxes, Nx4 or Nx6 torch tensor. The box mode is assumed to be ``StandardMode``
          proposals: list of boxes to be encoded, each element is Mx4 or Mx6 torch tensor.
              The box mode is assumed to be ``StandardMode``
  
      Return:
          A tuple of encoded gt, target of box regression that is used to
              convert proposals into gt_boxes, Nx4 or Nx6 torch tensor.
      """
      boxes_per_image = [len(b) for b in gt_boxes]
      # concat the lists to do computation
      concat_gt_boxes = torch.cat(tuple(gt_boxes), dim=0)
      concat_proposals = torch.cat(tuple(proposals), dim=0)
      concat_targets = self.encode_single(
          concat_gt_boxes, concat_proposals
      )
      # split to tuple
      targets: tuple[Tensor] = concat_targets.split(boxes_per_image, 0)
      return targets
  
file_path: MONAI/monai/apps/detection/utils/box_coder.py
imports: from __future__ import annotations
  import math
  from collections.abc import Sequence
  import torch
  from torch import Tensor
  from monai.data.box_utils import COMPUTE_DTYPE, CenterSizeMode, StandardMode, convert_box_mode, is_valid_box_values
  from monai.utils.module import look_up_option
label_desc: Use image node_id 2 for calling the BoxCoder obj's underlying member method code with example usage: obj.encode(gt_boxes, proposals) and returns: targets