Missed TensorFlow World? Check out the recap. Learn more



Defined in tensorflow/contrib/distributions/python/ops/bijectors/real_nvp.py.

Build a scale-and-shift function using a multi-layer neural network. (deprecated)

THIS FUNCTION IS DEPRECATED. It will be removed after 2018-10-01. Instructions for updating: The TensorFlow Distributions library has moved to TensorFlow Probability (https://github.com/tensorflow/probability). You should update all references to use tfp.distributions instead of tf.contrib.distributions.

This will be wrapped in a make_template to ensure the variables are only created once. It takes the d-dimensional input x[0:d] and returns the D-d dimensional outputs loc ("mu") and log_scale ("alpha").


  • hidden_layers: Python list-like of non-negative integer, scalars indicating the number of units in each hidden layer. Default: `[512, 512].
  • shift_only: Python bool indicating if only the shift term shall be computed (i.e. NICE bijector). Default: False.
  • activation: Activation function (callable). Explicitly setting to None implies a linear activation.
  • name: A name for ops managed by this function. Default: "real_nvp_default_template".
  • *args: tf.layers.dense arguments.
  • **kwargs: tf.layers.dense keyword arguments.


  • shift: Float-like Tensor of shift terms ("mu" in [Papamakarios et al. (2016)][1]).
  • log_scale: Float-like Tensor of log(scale) terms ("alpha" in [Papamakarios et al. (2016)][1]).


  • NotImplementedError: if rightmost dimension of inputs is unknown prior to graph execution.


[1]: George Papamakarios, Theo Pavlakou, and Iain Murray. Masked Autoregressive Flow for Density Estimation. In Neural Information Processing Systems, 2017. https://arxiv.org/abs/1705.07057