Type Permute
Namespace tensorflow.contrib.distributions.bijectors
Parent Bijector
Interfaces IPermute
Permutes the rightmost dimension of a `Tensor`.
Warning:
tf.estimator
may repeatedly build the graph thus
`Permute(np.random.permutation(event_size)).astype("int32"))` is not a
reliable parameterization (nor would it be even if using tf.constant
). A
safe alternative is to use `tf.compat.v1.get_variable` to achieve "init once"
behavior,
i.e.,
Show Example
import tensorflow_probability as tfp tfb = tfp.bijectors reverse = tfb.Permute(permutation=[2, 1, 0]) reverse.forward([-1., 0., 1.]) # ==> [1., 0., -1] reverse.inverse([1., 0., -1]) # ==> [-1., 0., 1.] reverse.forward_log_det_jacobian(any_value) # ==> 0. reverse.inverse_log_det_jacobian(any_value) # ==> 0.