class_docstr: This class encodes and decodes a set of bounding boxes into
  the representation used for training the regressors.
class_docstr_tok: ["This","class","encodes","and","decodes","a","set","of","bounding","boxes","into","the","representation","used","for","training","the","regressors","."]
code: def encode(
      self, reference_boxes: List[Tensor], proposals: List[Tensor]
  ) -> List[Tensor]:
      boxes_per_image = [len(b) for b in reference_boxes]
      reference_boxes = torch.cat(reference_boxes, dim=0)
      proposals = torch.cat(proposals, dim=0)
      targets = self.encode_single(reference_boxes, proposals)
      return targets.split(boxes_per_image, 0)
  
imports: import math
  from collections import OrderedDict
  from typing import Dict, List, Optional, Tuple
  import torch
  from torch import nn, Tensor
  from torch.nn import functional
  from torchvision.ops import complete_box_iou_loss, distance_box_iou_loss, FrozenBatchNorm2d, generalized_box_iou_loss
label_desc: Use image node_id 2 for calling the BoxCoder obj's underlying member method code with example usage: obj.encode(reference_boxes, proposals) and returns: targets