Attend the Women in ML Symposium on December 7 Register now

Module: tfp.layers

Stay organized with collections Save and categorize content based on your preferences.

Probabilistic Layers.


conv_variational module: Convolutional variational layers.

dense_variational module: Dense variational layers.

dense_variational_v2 module: DenseVariational layer.

distribution_layer module: Layers for combining tfp.distributions and tf.keras.

initializers module: Keras initializers useful for TFP Keras layers.

masked_autoregressive module: Layers for normalizing flows and masked autoregressive density estimation.

util module: Utilities for probabilistic layers.

variable_input module: VariableInputLayer.

weight_norm module: Layer wrapper for weight normalization.


class AutoregressiveTransform: An autoregressive normalizing flow layer.

class BlockwiseInitializer: Initializer which concats other intializers.

class CategoricalMixtureOfOneHotCategorical: A OneHotCategorical mixture Keras layer from k * (1 + d) params.

class Convolution1DFlipout: 1D convolution layer (e.g. temporal convolution) with Flipout.

class Convolution1DReparameterization: 1D convolution layer (e.g. temporal convolution).

class Convolution2DFlipout: 2D convolution layer (e.g. spatial convolution over images) with Flipout.

class Convolution2DReparameterization: 2D convolution layer (e.g. spatial convolution over images).

class Convolution3DFlipout: 3D convolution layer (e.g. spatial convolution over volumes) with Flipout.

class Convolution3DReparameterization: 3D convolution layer (e.g. spatial convolution over volumes).

class DenseFlipout: Densely-connected layer class with Flipout estimator.

class DenseLocalReparameterization: Densely-connected layer class with local reparameterization estimator.

class DenseReparameterization: Densely-connected layer class with reparameterization estimator.

class DenseVariational: Dense layer with random kernel and bias.

class DistributionLambda: Keras layer enabling plumbing TFP distributions through Keras models.

class IndependentBernoulli: An Independent-Bernoulli Keras layer from prod(event_shape) params.

class IndependentLogistic: An independent logistic Keras layer.

class IndependentNormal: An independent normal Keras layer.

class IndependentPoisson: An independent Poisson Keras layer.

class KLDivergenceAddLoss: Pass-through layer that adds a KL divergence penalty to the model loss.

class KLDivergenceRegularizer: Regularizer that adds a KL divergence penalty to the model loss.

class MixtureLogistic: A mixture distribution Keras layer, with independent logistic components.

class MixtureNormal: A mixture distribution Keras layer, with independent normal components.

class MixtureSameFamily: A mixture (same-family) Keras layer.

class MultivariateNormalTriL: A d-variate MVNTriL Keras layer from d + d * (d + 1) // 2 params.

class OneHotCategorical: A d-variate OneHotCategorical Keras layer from d params.

class VariableLayer: Simply returns a (trainable) variable, regardless of input.

class VariationalGaussianProcess: A VariationalGaussianProcess Layer.


default_loc_scale_fn(...): Makes closure which creates loc, scale params from tf.get_variable.

default_mean_field_normal_fn(...): Creates a function to build Normal distributions with trainable params.

default_multivariate_normal_fn(...): Creates multivariate standard Normal distribution.