class_docstr: Reshapes the `event_shape` of a `Tensor`.
  
  The semantics generally follow that of `tf.reshape()`, with
  a few differences:
  
  * The user must provide both the input and output shape, so that
    the transformation can be inverted. If an input shape is not
    specified, the default assumes a vector-shaped input, i.e.,
    event_shape_in = (-1,).
  * The `Reshape` bijector automatically broadcasts over the leftmost
    dimensions of its input (`sample_shape` and `batch_shape`); only
    the rightmost `event_ndims_in` dimensions are reshaped. The
    number of dimensions to reshape is inferred from the provided
    `event_shape_in` (`event_ndims_in = len(event_shape_in)`).
  
  Example usage:
  
  ```python
  r = tfp.bijectors.Reshape(event_shape_out=[1, -1])
  
  r.forward([3., 4.])    # shape [2]
  # ==> [[3., 4.]]       # shape [1, 2]
  
  r.forward([[1., 2.], [3., 4.]])  # shape [2, 2]
  # ==> [[[1., 2.]],
  #      [[3., 4.]]]   # shape [2, 1, 2]
  
  r.inverse([[3., 4.]])  # shape [1,2]
  # ==> [3., 4.]         # shape [2]
  
  r.forward_log_det_jacobian(any_value)
  # ==> 0.
  
  r.inverse_log_det_jacobian(any_value)
  # ==> 0.
  ```
  
  Note: we had to make a tricky-to-describe policy decision, which we attempt to
  summarize here. At instantiation time and class method invocation time, we
  validate consistency of class-level and method-level arguments. Note that
  since the class-level arguments may be unspecified until graph execution time,
  we had the option of deciding between two validation policies. One was,
  roughly, "the earliest, most statically specified arguments take precedence".
  The other was "method-level arguments must be consistent with class-level
  arguments". The former policy is in a sense more optimistic about user intent,
  and would enable us, in at least one particular case [1], to perform
  additional inference about resulting shapes. We chose the latter policy, as it
  is simpler to implement and a bit easier to articulate.
  
  [1] The case in question is exemplified in the following snippet:
  
  ```python
  bijector = tfp.bijectors.Reshape(
    event_shape_out=tf.placeholder(dtype=tf.int32, shape=[1]),
    event_shape_in= tf.placeholder(dtype=tf.int32, shape=[3]),
    validate_args=True)
  
  bijector.forward_event_shape(tf.TensorShape([5, 2, 3, 7]))
  # Chosen policy    ==> (5, None)
  # Alternate policy ==> (5, 42)
  ```
  
  In the chosen policy, since we don't know what `event_shape_in/out` are at the
  time of the call to `forward_event_shape`, we simply fill in everything we
  *do* know, which is that the last three dims will be replaced with
  "something".
  
  In the alternate policy, we would assume that the intention must be to reshape
  `[5, 2, 3, 7]` such that the last three dims collapse to one, which is only
  possible if the resulting shape is `[5, 42]`.
  
  Note that the above is the *only* case in which we could do such inference; if
  the output shape has more than 1 dim, we can't infer anything. E.g., we would
  have
  
  ```python
  bijector = tfp.bijectors.Reshape(
    event_shape_out=tf.placeholder(dtype=tf.int32, shape=[2]),
    event_shape_in= tf.placeholder(dtype=tf.int32, shape=[3]),
    validate_args=True)
  
  bijector.forward_event_shape(tf.TensorShape([5, 2, 3, 7]))
  # Either policy ==> (5, None, None)
  ```
class_docstr_tok: ["Reshapes","the","`","event_shape","`","of","a","`","Tensor","`",".","The","semantics","generally","follow","that","of","`","tf.reshape","(",")","`",",","with","a","few","differences",":","*","The","user","must","provide","both","the","input","and","output","shape",",","so","that","the","transformation","can","be","inverted",".","If","an","input","shape","is","not","specified",",","the","default","assumes","a","vector-shaped","input",",","i.e.",",","event_shape_in","=","(","-1",",",")",".","*","The","`","Reshape","`","bijector","automatically","broadcasts","over","the","leftmost","dimensions","of","its","input","(","`","sample_shape","`","and","`","batch_shape","`",")",";","only","the","rightmost","`","event_ndims_in","`","dimensions","are","reshaped",".","The","number","of","dimensions","to","reshape","is","inferred","from","the","provided","`","event_shape_in","`","(","`","event_ndims_in","=","len","(","event_shape_in",")","`",")",".","Example","usage",":","``","`","python","r","=","tfp.bijectors.Reshape","(","event_shape_out=","[","1",",","-1","]",")","r.forward","(","[","3.",",","4",".","]",")","#","shape","[","2","]","#","==",">","[","[","3.",",","4",".","]","]","#","shape","[","1",",","2","]","r.forward","(","[","[","1.",",","2",".","]",",","[","3.",",","4",".","]","]",")","#","shape","[","2",",","2","]","#","==",">","[","[","[","1.",",","2",".","]","]",",","#","[","[","3.",",","4",".","]","]","]","#","shape","[","2",",","1",",","2","]","r.inverse","(","[","[","3.",",","4",".","]","]",")","#","shape","[","1,2","]","#","==",">","[","3.",",","4",".","]","#","shape","[","2","]","r.forward_log_det_jacobian","(","any_value",")","#","==",">","0.","r.inverse_log_det_jacobian","(","any_value",")","#","==",">","0",".","``","`","Note",":","we","had","to","make","a","tricky-to-describe","policy","decision",",","which","we","attempt","to","summarize","here",".","At","instantiation","time","and","class","method","invocation","time",",","we","validate","consistency","of","class-level","and","method-level","arguments",".","Note","that","since","the","class-level","arguments","may","be","unspecified","until","graph","execution","time",",","we","had","the","option","of","deciding","between","two","validation","policies",".","One","was",",","roughly",",","``","the","earliest",",","most","statically","specified","arguments","take","precedence","''",".","The","other","was","``","method-level","arguments","must","be","consistent","with","class-level","arguments","''",".","The","former","policy","is","in","a","sense","more","optimistic","about","user","intent",",","and","would","enable","us",",","in","at","least","one","particular","case","[","1","]",",","to","perform","additional","inference","about","resulting","shapes",".","We","chose","the","latter","policy",",","as","it","is","simpler","to","implement","and","a","bit","easier","to","articulate",".","[","1","]","The","case","in","question","is","exemplified","in","the","following","snippet",":","``","`","python","bijector","=","tfp.bijectors.Reshape","(","event_shape_out=tf.placeholder","(","dtype=tf.int32",",","shape=","[","1","]",")",",","event_shape_in=","tf.placeholder","(","dtype=tf.int32",",","shape=","[","3","]",")",",","validate_args=True",")","bijector.forward_event_shape","(","tf.TensorShape","(","[","5",",","2",",","3",",","7","]",")",")","#","Chosen","policy","==",">","(","5",",","None",")","#","Alternate","policy","==",">","(","5",",","42",")","``","`","In","the","chosen","policy",",","since","we","do","n't","know","what","`","event_shape_in\/out","`","are","at","the","time","of","the","call","to","`","forward_event_shape","`",",","we","simply","fill","in","everything","we","*","do","*","know",",","which","is","that","the","last","three","dims","will","be","replaced","with","''","something","''",".","In","the","alternate","policy",",","we","would","assume","that","the","intention","must","be","to","reshape","`","[","5",",","2",",","3",",","7","]","`","such","that","the","last","three","dims","collapse","to","one",",","which","is","only","possible","if","the","resulting","shape","is","`","[","5",",","42","]","`",".","Note","that","the","above","is","the","*","only","*","case","in","which","we","could","do","such","inference",";","if","the","output","shape","has","more","than","1","dim",",","we","ca","n't","infer","anything",".","E.g.",",","we","would","have","``","`","python","bijector","=","tfp.bijectors.Reshape","(","event_shape_out=tf.placeholder","(","dtype=tf.int32",",","shape=","[","2","]",")",",","event_shape_in=","tf.placeholder","(","dtype=tf.int32",",","shape=","[","3","]",")",",","validate_args=True",")","bijector.forward_event_shape","(","tf.TensorShape","(","[","5",",","2",",","3",",","7","]",")",")","#","Either","policy","==",">","(","5",",","None",",","None",")","``","`"]
code: def _inverse(self, y):
      (
          output_shape,
          output_tensorshape,
      ) = _replace_event_shape_in_shape_tensor(
          ps.shape(y),
          self._event_shape_out,
          self._event_shape_in,
          self.validate_args,
      )
      x = tf.reshape(y, output_shape)
      tensorshape_util.set_shape(x, output_tensorshape)
      return x
  
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 dtype_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 6 for calling the Reshape obj's underlying member method code with example usage: obj._inverse(y) and returns: x