code: def pairwise_iou_record_record(
      target: BaseRecord, prediction: BaseRecord
  ):
      """
      Calculates pairwise iou on prediction and target BaseRecord. Uses torchvision implementation of `box_iou`.
      """
      stacked_preds = [
          bbox.to_tensor() for bbox in prediction.detection.bboxes
      ]
      stacked_preds = (
          torch.stack(stacked_preds)
          if stacked_preds
          else torch.empty(0, 4)
      )
  
      stacked_targets = [
          bbox.to_tensor() for bbox in target.detection.bboxes
      ]
      stacked_targets = (
          torch.stack(stacked_targets)
          if stacked_targets
          else torch.empty(0, 4)
      )
      return torchvision.ops.box_iou(stacked_preds, stacked_targets)
  
imports: from icevision.imports import *
  from icevision import BBox, BaseRecord
label_desc: Use image node_id 2 for calling a global function with example usage: pairwise_iou_record_record(target, prediction) and returns: torchvision