code: def align_tensor(
      inputs: List[Tensor], max_len: Optional[int] = None
  ) -> Tensor:
      """Pad each input to `max_len`, then stack them. If `max_len` is None, then
      it is the max size of the first dimension of each input.
  
          https://github.com/jshilong/DDQ/blob/ddq_detr/projects/models/\
          utils.py#L12
  
      Args:
          inputs (list[Tensor]): The tensors to be padded,
              Each input should have the same shape except the first dimension.
          max_len (int): Padding target size in the first dimension.
              Default: None
      Returns:
          Tensor: Stacked inputs after padding in the first dimension.
      """
      if max_len is None:
          max_len = max([len(item) for item in inputs])
  
      return torch.stack([padding_to(item, max_len) for item in inputs])
  
imports: from functools import partial
  from typing import List, Optional, Sequence, Tuple, Union
  import numpy
  import torch
  from mmengine.structures import InstanceData
  from mmengine.utils import digit_version
  from six.moves import map, zip
  from torch import Tensor
  from torch.autograd import Function
  from torch.nn import functional
  from mmdet.structures import SampleList
  from mmdet.structures.bbox import BaseBoxes, get_box_type, stack_boxes
  from mmdet.structures.mask import BitmapMasks, PolygonMasks
  from mmdet.utils import OptInstanceList
label_desc: Use image node_id 25 for calling a global function with example usage: align_tensor(inputs, max_len) and returns: torch