class_docstr: Pad the input ndarrays along the specific padding axis and stack them to get the output.
  Input of the function will be N samples. Each sample should contain a single element that
  can be 1) numpy.ndarray, 2) mxnet.nd.NDArray, 3) list of numbers.
  You can set the `axis` and `pad_val` to determine the padding axis and
  value.
  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
  ----------
  axis : int or tuple, default 0
      The axis to pad the arrays. The arrays will be padded to the largest dimension at
      pad_axis. For example, assume the input arrays have shape
      (10, 8, 5), (6, 8, 5), (3, 8, 5) and the pad_axis is 0. Each input will be padded into
      (10, 8, 5) and then stacked to form the final output.
  pad_val : float or int, default 0
      The padding value.
  num_shards : int, default 1
      Number of shards to create. Each shard are padded separately.
  ret_length : bool, default False
      Whether to return the valid length in the output.
  Examples
  --------
  >>> from gluoncv.data import batchify
  >>> # Inputs are multiple lists
  >>> a = [1, 2, 3, 4]
  >>> b = [4, 5, 6]
  >>> c = [8, 2]
  >>> batchify.Pad()([a, b, c])
  [[ 1  2  3  4]
   [ 4  5  6  0]
   [ 8  2  0  0]]
  <NDArray 3x4 @cpu(0)>
  >>> # Also output the lengths
  >>> a = [1, 2, 3, 4]
  >>> b = [4, 5, 6]
  >>> c = [8, 2]
  >>> batchify.Pad(ret_length=True)([a, b, c])
  (
   [[1 2 3 4]
    [4 5 6 0]
    [8 2 0 0]]
   <NDArray 3x4 @cpu(0)>,
   [4 3 2]
   <NDArray 3 @cpu(0)>)
  >>> # Inputs are multiple ndarrays
  >>> import numpy as np
  >>> a = np.array([[1, 2, 3, 4], [5, 6, 7, 8]])
  >>> b = np.array([[5, 8], [1, 2]])
  >>> batchify.Pad(axis=1, pad_val=-1)([a, b])
  [[[ 1  2  3  4]
    [ 5  6  7  8]]
   [[ 5  8 -1 -1]
    [ 1  2 -1 -1]]]
  <NDArray 2x2x4 @cpu(0)>
  >>> # Inputs are multiple NDArrays
  >>> import mxnet as mx
  >>> a = mx.nd.array([[1, 2, 3, 4], [5, 6, 7, 8]])
  >>> b = mx.nd.array([[5, 8], [1, 2]])
  >>> batchify.Pad(axis=1, pad_val=-1)([a, b])
  [[[ 1.  2.  3.  4.]
    [ 5.  6.  7.  8.]]
   [[ 5.  8. -1. -1.]
    [ 1.  2. -1. -1.]]]
  <NDArray 2x2x4 @cpu(0)>
class_docstr_tok: ["Pad","the","input","ndarrays","along","the","specific","padding","axis","and","stack","them","to","get","the","output",".","Input","of","the","function","will","be","N","samples",".","Each","sample","should","contain","a","single","element","that","can","be","1",")","numpy.ndarray",",","2",")","mxnet.nd.NDArray",",","3",")","list","of","numbers",".","You","can","set","the","`","axis","`","and","`","pad_val","`","to","determine","the","padding","axis","and","value",".","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","--","--","--","--","--","axis",":","int","or","tuple",",","default","0","The","axis","to","pad","the","arrays",".","The","arrays","will","be","padded","to","the","largest","dimension","at","pad_axis",".","For","example",",","assume","the","input","arrays","have","shape","(","10",",","8",",","5",")",",","(","6",",","8",",","5",")",",","(","3",",","8",",","5",")","and","the","pad_axis","is","0",".","Each","input","will","be","padded","into","(","10",",","8",",","5",")","and","then","stacked","to","form","the","final","output",".","pad_val",":","float","or","int",",","default","0","The","padding","value",".","num_shards",":","int",",","default","1","Number","of","shards","to","create",".","Each","shard","are","padded","separately",".","ret_length",":","bool",",","default","False","Whether","to","return","the","valid","length","in","the","output",".","Examples","--","--","--","--",">",">",">","from","gluoncv.data","import","batchify",">",">",">","#","Inputs","are","multiple","lists",">",">",">","a","=","[","1",",","2",",","3",",","4","]",">",">",">","b","=","[","4",",","5",",","6","]",">",">",">","c","=","[","8",",","2","]",">",">",">","batchify.Pad","(",")","(","[","a",",","b",",","c","]",")","[","[","1","2","3","4","]","[","4","5","6","0","]","[","8","2","0","0","]","]","<","NDArray","3x4","@","cpu","(","0",")",">",">",">",">","#","Also","output","the","lengths",">",">",">","a","=","[","1",",","2",",","3",",","4","]",">",">",">","b","=","[","4",",","5",",","6","]",">",">",">","c","=","[","8",",","2","]",">",">",">","batchify.Pad","(","ret_length=True",")","(","[","a",",","b",",","c","]",")","(","[","[","1","2","3","4","]","[","4","5","6","0","]","[","8","2","0","0","]","]","<","NDArray","3x4","@","cpu","(","0",")",">",",","[","4","3","2","]","<","NDArray","3","@","cpu","(","0",")",">",")",">",">",">","#","Inputs","are","multiple","ndarrays",">",">",">","import","numpy","as","np",">",">",">","a","=","np.array","(","[","[","1",",","2",",","3",",","4","]",",","[","5",",","6",",","7",",","8","]","]",")",">",">",">","b","=","np.array","(","[","[","5",",","8","]",",","[","1",",","2","]","]",")",">",">",">","batchify.Pad","(","axis=1",",","pad_val=-1",")","(","[","a",",","b","]",")","[","[","[","1","2","3","4","]","[","5","6","7","8","]","]","[","[","5","8","-1","-1","]","[","1","2","-1","-1","]","]","]","<","NDArray","2x2x4","@","cpu","(","0",")",">",">",">",">","#","Inputs","are","multiple","NDArrays",">",">",">","import","mxnet","as","mx",">",">",">","a","=","mx.nd.array","(","[","[","1",",","2",",","3",",","4","]",",","[","5",",","6",",","7",",","8","]","]",")",">",">",">","b","=","mx.nd.array","(","[","[","5",",","8","]",",","[","1",",","2","]","]",")",">",">",">","batchify.Pad","(","axis=1",",","pad_val=-1",")","(","[","a",",","b","]",")","[","[","[","1",".","2",".","3",".","4",".","]","[","5",".","6",".","7",".","8",".","]","]","[","[","5",".","8",".","-1",".","-1",".","]","[","1",".","2",".","-1",".","-1",".","]","]","]","<","NDArray","2x2x4","@","cpu","(","0",")",">"]
code: def __init__(self, axis=0, pad_val=0, num_shards=1, ret_length=False):
      self._axis = axis
      assert isinstance(axis, (int, tuple, list)), (
          "axis must be an integer, tuple or list! "
          "Received axis=%s, type=%s." % (str(axis), str(type(axis)))
      )
      self._pad_val = pad_val
      self._num_shards = num_shards
      self._ret_length = ret_length
  
imports: import logging
  import numpy
  import mxnet
label_desc: Use image node_id 1 to create a new Pad object from inherited base classes: object with example: obj = Pad(axis, pad_val, num_shards, ret_length)