code: def concat_box_prediction_layers(
      box_cls: List[Tensor], box_regression: List[Tensor]
  ) -> Tuple[Tensor, Tensor]:
      box_cls_flattened = []
      box_regression_flattened = []
      # for each feature level, permute the outputs to make them be in the
      # same format as the labels. Note that the labels are computed for
      # all feature levels concatenated, so we keep the same representation
      # for the objectness and the box_regression
      for box_cls_per_level, box_regression_per_level in zip(
          box_cls, box_regression
      ):
          N, AxC, H, W = box_cls_per_level.shape
          Ax4 = box_regression_per_level.shape[1]
          A = Ax4 // 4
          C = AxC // A
          box_cls_per_level = permute_and_flatten(
              box_cls_per_level, N, A, C, H, W
          )
          box_cls_flattened.append(box_cls_per_level)
  
          box_regression_per_level = permute_and_flatten(
              box_regression_per_level, N, A, 4, H, W
          )
          box_regression_flattened.append(box_regression_per_level)
      # concatenate on the first dimension (representing the feature levels), to
      # take into account the way the labels were generated (with all feature maps
      # being concatenated as well)
      box_cls = torch.cat(box_cls_flattened, dim=1).flatten(0, -2)
      box_regression = torch.cat(
          box_regression_flattened, dim=1
      ).reshape(-1, 4)
      return box_cls, box_regression
  
imports: from typing import Dict, List, Optional, Tuple
  import torch
  from torch import nn, Tensor
  from torch.nn import functional
  from torchvision.ops import boxes, Conv2dNormActivation
  from .None import _utils
  from .anchor_utils import AnchorGenerator
  from .image_list import ImageList
label_desc: Use image node_id 2 for calling a global function with example usage: concat_box_prediction_layers(box_cls, box_regression) and returns: box_cls,  box_regression