LostTech.TensorFlow : API Documentation

Type Reshape

Namespace tensorflow.contrib.distributions.bijectors

Parent Bijector

Interfaces IReshape

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:
Show Example
import tensorflow_probability as tfp
            tfb = tfp.bijectors 

r = tfb.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.

Properties

Public properties

object dtype get;

object dtype_dyn get;

object forward_min_event_ndims get;

object forward_min_event_ndims_dyn get;

IList<object> graph_parents get;

object graph_parents_dyn get;

object inverse_min_event_ndims get;

object inverse_min_event_ndims_dyn get;

bool is_constant_jacobian get;

object is_constant_jacobian_dyn get;

object name get;

object name_dyn get;

object PythonObject get;

bool validate_args get;

object validate_args_dyn get;