code: def _pad_arrs_to_max_length(
      arrs, pad_axis, pad_val, round_to=None, max_length=None
  ):
      """
      Inner Implementation of the Pad collate.
  
      Parameters
      ----------
          arrs (list)
          pad_axis (int)
          pad_val (number)
          round_to (int, optional). (default: ``None``)
          max_length (int, optional). (default: ``None``)
  
      Returns
      -------
          ret : torch.Tensor
          original_length : torch.Tensor
      """
      if not isinstance(arrs[0], torch.Tensor):
          arrs = [torch.as_tensor(ele) for ele in arrs]
  
      original_length = [ele.size(pad_axis) for ele in arrs]
      max_arr_len = max(original_length)
  
      if round_to is not None:
          max_arr_len = round_to * math.ceil(max_arr_len / round_to)
      elif max_length is not None:
          if max_length < max_arr_len:
              raise ValueError(
                  f"If max_length is specified, max_length={max_length} must be larger "
                  f"than the maximum length {max_arr_len} of the given arrays at axis={pad_axis}"
              )
          max_arr_len = max_length
  
      size = arrs[0].size()
      prev_trailing_dims = size[:pad_axis]
      after_trailing_dims = size[pad_axis + 1 :]
  
      out_dims = (
          (len(arrs),)
          + prev_trailing_dims
          + (max_arr_len,)
          + after_trailing_dims
      )
      out_tensor = arrs[0].new_full(out_dims, pad_val)
      for i, tensor in enumerate(arrs):
          length = tensor.size(pad_axis)
          out_tensor[i].narrow(pad_axis, 0, length)[:] = tensor
  
      original_length = torch.as_tensor(original_length)
  
      return out_tensor, original_length
  
file_path: autogluon/multimodal/src/autogluon/multimodal/data/collator.py
imports: import math
  import warnings
  import numpy
  import torch
label_desc: Use image node_id 1 for calling a global function with example usage: _pad_arrs_to_max_length(arrs, pad_axis, pad_val, round_to, max_length) and returns: out_tensor,  original_length