class_docstr: Returns a callable that pads and stacks data.
  
  Parameters
  ----------
      axis (int, optional): The axis to pad the arrays.
          The arrays will be padded to the largest dimension at :attr:`axis`.
          For example, assume the input arrays have shape (10, 8, 5), (6, 8, 5), (3, 8, 5)
          and the `axis` is 0.
          Each input will be padded into (10, 8, 5) and then stacked to form the final output,
          which has shape（3, 10, 8, 5). (default ``0``)
      pad_val (float or int, optional): The padding value. (default ``0``)
      round_to (int, optional):
          If specified, the padded dimension will be rounded to be multiple of this argument.
          Mutually exclusive with :attr:`max_length`. (default ``None``)
      max_length (int, optional):
          If specified, the padded dimension will have length :attr:`max_length`,
          and it must be larger than the maximum length in the arrays at :attr:`axis`.
          Mutually exclusive with :attr:`round_to`.  (default ``None``)
      ret_length (bool, optional): Whether to return the valid length in the output.
          (default ``False``)
class_docstr_tok: ["Returns","a","callable","that","pads","and","stacks","data",".","Parameters","--","--","--","--","--","axis","(","int",",","optional",")",":","The","axis","to","pad","the","arrays",".","The","arrays","will","be","padded","to","the","largest","dimension","at",":","attr",":","`","axis","`",".","For","example",",","assume","the","input","arrays","have","shape","(","10",",","8",",","5",")",",","(","6",",","8",",","5",")",",","(","3",",","8",",","5",")","and","the","`","axis","`","is","0",".","Each","input","will","be","padded","into","(","10",",","8",",","5",")","and","then","stacked","to","form","the","final","output",",","which","has","shape\uff083",",","10",",","8",",","5",")",".","(","default","``","0","``",")","pad_val","(","float","or","int",",","optional",")",":","The","padding","value",".","(","default","``","0","``",")","round_to","(","int",",","optional",")",":","If","specified",",","the","padded","dimension","will","be","rounded","to","be","multiple","of","this","argument",".","Mutually","exclusive","with",":","attr",":","`","max_length","`",".","(","default","``","None","``",")","max_length","(","int",",","optional",")",":","If","specified",",","the","padded","dimension","will","have","length",":","attr",":","`","max_length","`",",","and","it","must","be","larger","than","the","maximum","length","in","the","arrays","at",":","attr",":","`","axis","`",".","Mutually","exclusive","with",":","attr",":","`","round_to","`",".","(","default","``","None","``",")","ret_length","(","bool",",","optional",")",":","Whether","to","return","the","valid","length","in","the","output",".","(","default","``","False","``",")"]
docstr: Collate the input data.
  
  The arrays will be padded to the largest dimension at `axis` and then
  stacked to form the final output. In addition, the function will output
  the original dimensions at the `axis` if ret_length is turned on.
  
  Parameters
  ----------
      data : List[np.ndarray] or List[List[dtype]] or List[torch.Tensor]
          List of samples to pad and stack.
  
  Returns
  -------
      batch_data (torch.Tensor): Data in the minibatch. Shape is (N, ...)
      valid_length (NDArray, optional):
          The sequences' original lengths at the padded axis. Shape is (N,). This will only be
          returned if `ret_length` is True.
docstr_tok: ["Collate","the","input","data",".","The","arrays","will","be","padded","to","the","largest","dimension","at","`","axis","`","and","then","stacked","to","form","the","final","output",".","In","addition",",","the","function","will","output","the","original","dimensions","at","the","`","axis","`","if","ret_length","is","turned","on",".","Parameters","--","--","--","--","--","data",":","List","[","np.ndarray","]","or","List","[","List","[","dtype","]","]","or","List","[","torch.Tensor","]","List","of","samples","to","pad","and","stack",".","Returns","--","--","--","-","batch_data","(","torch.Tensor",")",":","Data","in","the","minibatch",".","Shape","is","(","N",",","...",")","valid_length","(","NDArray",",","optional",")",":","The","sequences","'","original","lengths","at","the","padded","axis",".","Shape","is","(","N",",",")",".","This","will","only","be","returned","if","`","ret_length","`","is","True","."]
code: def __call__(self, data):
      """
      Collate the input data.
  
      The arrays will be padded to the largest dimension at `axis` and then
      stacked to form the final output. In addition, the function will output
      the original dimensions at the `axis` if ret_length is turned on.
  
      Parameters
      ----------
          data : List[np.ndarray] or List[List[dtype]] or List[torch.Tensor]
              List of samples to pad and stack.
  
      Returns
      -------
          batch_data (torch.Tensor): Data in the minibatch. Shape is (N, ...)
          valid_length (NDArray, optional):
              The sequences' original lengths at the padded axis. Shape is (N,). This will only be
              returned if `ret_length` is True.
  
      """
      if isinstance(data[0], (torch.Tensor, np.ndarray, list, tuple)):
          padded_arr, original_length = _pad_arrs_to_max_length(
              data,
              pad_axis=self._axis,
              pad_val=self._pad_val,
              round_to=self._round_to,
              max_length=self._max_length,
          )
          if self._ret_length:
              return padded_arr, original_length
          else:
              return padded_arr
      else:
          raise NotImplementedError
  
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 2 for calling the PadCollator obj's underlying member method code with example usage: obj.__call__(data) and returns: padded_arr,  original_length, padded_arr