class_docstr: Pads a value to the `event_shape` of a `Tensor`.
  
  The semantics of `tfp.bijectors.Pad` generally follow that of `tf.pad()`
  except that `tfp.bijectors.Pad`'s `paddings` argument applies to the rightmost
  dimensions. Additionally, the new argument `axis` enables overriding the
  dimensions to which `paddings` is applied. Like `paddings`, the `axis`
  argument is also relative to the rightmost dimension and must therefore be
  negative.
  
  The argument `paddings` is a vector of `int` pairs each representing the
  number of left and/or right `constant_values` to pad to the corresponding
  righmost dimensions. That is, unless `axis` is specified, specifiying `k`
  different `paddings` means the rightmost `k` dimensions will be "grown" by the
  sum of the respective `paddings` row. When `axis` is specified, it indicates
  the dimension to which the corresponding `paddings` element is applied. By
  default `axis` is `None` which means it is logically equivalent to
  `range(start=-len(paddings), limit=0)`, i.e., the rightmost dimensions.
  
  Example usage:
  
  ```python
  b = tfp.bijectors.Pad()  # Default arguments.
  
  b.forward([3., 4.])      # shape: [2]
  # ==> [[3., 4., 0.]]     # shape: [3]
  
  b.forward([[1., 2.],
             [3., 4.]])    # shape: [2, 2]
  # ==> [[1., 2., 0.],
  #      [3., 4., 0.]]     # shape: [2, 3]
  
  b.inverse([3., 4., 0.])  # shape: [3]
  # ==> [3., 4.]           # shape: [2]
  
  b.forward_log_det_jacobian(any_value)
  # ==> 0.
  
  b.inverse_log_det_jacobian(any_value)
  # ==> 0.
  ```
  
  ```python
  b = tfp.bijectors.Pad(axis=-2)  # With non-default `axis` arg.
  
  b.forward([[3., 4.]])    # shape: [1, 2]
  # ==> [[3., 4.],         # shape: [2, 2]
  #      [0., 0.]]
  
  b.inverse([[3., 4.],     # shape: [2, 2]
             [0., 0.]])
  # ==> [[3., 4.]]         # shape: [1, 2]
  
  b.forward_log_det_jacobian(any_value)
  # ==> 0.
  
  b.inverse_log_det_jacobian(any_value)
  # ==> 0.
  ```
docstr: Initializes the `Pad` bijector.
  
  Args:
    paddings: A vector-shaped `Tensor` of `int` pairs representing the number
      of elements to pad on the left and right, respectively.
      Default value: `((0, 1),)`.
    mode: One of `'CONSTANT'`, `'REFLECT'`, or `'SYMMETRIC'`
      (case-insensitive). For more details, see `tf.pad`.
    constant_values: In "CONSTANT" mode, the scalar pad value to use. Must be
      same type as `tensor`. For more details, see `tf.pad`.
    axis: The dimensions for which `paddings` are applied. Must be 1:1 with
      `paddings` or `None`.
      Default value: `None` (i.e., `tf.range(start=-len(paddings), limit=0)`).
    validate_args: Python `bool` indicating whether arguments should
      be checked for correctness.
      Default value: `False`.
    name: Python `str`, name given to ops managed by this object.
      Default value: `None` (i.e., `'pad'`).
docstr_tok: ["Initializes","the","`","Pad","`","bijector",".","Args",":","paddings",":","A","vector-shaped","`","Tensor","`","of","`","int","`","pairs","representing","the","number","of","elements","to","pad","on","the","left","and","right",",","respectively",".","Default","value",":","`","(","(","0",",","1",")",",",")","`",".","mode",":","One","of","`","'CONSTANT","'","`",",","`","'REFLECT","'","`",",","or","`","'SYMMETRIC","'","`","(","case-insensitive",")",".","For","more","details",",","see","`","tf.pad","`",".","constant_values",":","In","``","CONSTANT","''","mode",",","the","scalar","pad","value","to","use",".","Must","be","same","type","as","`","tensor","`",".","For","more","details",",","see","`","tf.pad","`",".","axis",":","The","dimensions","for","which","`","paddings","`","are","applied",".","Must","be","1:1","with","`","paddings","`","or","`","None","`",".","Default","value",":","`","None","`","(","i.e.",",","`","tf.range","(","start=-len","(","paddings",")",",","limit=0",")","`",")",".","validate_args",":","Python","`","bool","`","indicating","whether","arguments","should","be","checked","for","correctness",".","Default","value",":","`","False","`",".","name",":","Python","`","str","`",",","name","given","to","ops","managed","by","this","object",".","Default","value",":","`","None","`","(","i.e.",",","`","'pad","'","`",")","."]
code: def __init__(
      self,
      paddings=((0, 1),),
      mode="CONSTANT",
      constant_values=0,
      axis=None,
      validate_args=False,
      name=None,
  ):
      """Initializes the `Pad` bijector.
  
      Args:
        paddings: A vector-shaped `Tensor` of `int` pairs representing the number
          of elements to pad on the left and right, respectively.
          Default value: `((0, 1),)`.
        mode: One of `'CONSTANT'`, `'REFLECT'`, or `'SYMMETRIC'`
          (case-insensitive). For more details, see `tf.pad`.
        constant_values: In "CONSTANT" mode, the scalar pad value to use. Must be
          same type as `tensor`. For more details, see `tf.pad`.
        axis: The dimensions for which `paddings` are applied. Must be 1:1 with
          `paddings` or `None`.
          Default value: `None` (i.e., `tf.range(start=-len(paddings), limit=0)`).
        validate_args: Python `bool` indicating whether arguments should
          be checked for correctness.
          Default value: `False`.
        name: Python `str`, name given to ops managed by this object.
          Default value: `None` (i.e., `'pad'`).
      """
      parameters = dict(locals())
      with tf.name_scope(name or "pad") as name:
          paddings = tensor_util.convert_nonref_to_tensor(
              paddings,
              dtype_hint=tf.int32,
              name="paddings",
              as_shape_tensor=True,
          )
          if axis is None:
              axis = ps.range(
                  start=-ps.size0(paddings),
                  limit=0,
                  dtype=tf.int32,
                  name="axis",
              )
          else:
              axis = tensor_util.convert_nonref_to_tensor(
                  axis,
                  dtype_hint=tf.int32,
                  name="axis",
                  as_shape_tensor=True,
              )
          axis_ = tf.get_static_value(axis)
          if axis_ is None:
              raise NotImplementedError(
                  "Argument `axis` must be known statically. If you need this "
                  "feature,  please contact `tfprobability@tensorflow.org`."
              )
          self._axis = axis
          self._paddings = paddings
          self._mode = mode
          self._constant_values = tensor_util.convert_nonref_to_tensor(
              constant_values,
              dtype_hint=tf.float32,
              name="constant_values",
          )
          min_event_ndims_ = int(
              -np.min(
                  np.pad(
                      np.reshape(axis_, newshape=[-1]),
                      mode="constant",
                      pad_width=[[0, 1]],
                  )
              )
          )
          super(Pad, self).__init__(
              forward_min_event_ndims=min_event_ndims_,
              inverse_min_event_ndims=min_event_ndims_,
              is_constant_jacobian=True,
              validate_args=validate_args,
              parameters=parameters,
              name=name,
          )
  
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import bijector
  from tensorflow_probability.python.internal import assert_util
  from tensorflow_probability.python.internal import parameter_properties
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import tensor_util
  from tensorflow_probability.python.internal import tensorshape_util
label_desc: Use image node_id 1 to create a new Pad object from inherited base classes: bijector with example: obj = Pad(paddings, mode, constant_values, axis, validate_args, name)