Menu

Helper Module for Deep Learning.

Common distributions.

class pynet.models.vae.distributions.ConditionalBernoulli(input_dim, final_dim, dense_hidden_dims=None, bias_init=0.0, hidden_activation_fn=<MagicMock name='mock.ReLU' id='140325667718480'>, dropout=0)[source]

A Bernoulli distribution conditioned on inputs via a dense network.

__init__(input_dim, final_dim, dense_hidden_dims=None, bias_init=0.0, hidden_activation_fn=<MagicMock name='mock.ReLU' id='140325667718480'>, dropout=0)[source]

Init class.

Parameters

input_dim: int

the input size.

final_dim: int

the dimension of the random variable.

dense_hidden_dims: list of int, default None

the sizes of the hidden layers of the fully connected network used to condition the distribution on the inputs. If None, then the default is a single-layered dense network.

bias_init: float, default 0

a scalar or tensor that is added to the output of the fully connected network and parameterizes the distribution mean.

hidden_activation_fn: @callable, default relu

the activation function to use on the hidden layers of the fully connected network.

dropout: float, default 0

define the dropout rate.

forward(tensor_list)[source]

Creates a Bernoulli distribution conditioned on the inputs.

Parameters

tensor_list: list of torch.Tensor

a list of tensors that will be first concatenatedd on the last dimension.

class pynet.models.vae.distributions.ConditionalCategorical(input_dim, final_dim, dense_hidden_dims=None, temperature=1.0, hidden_activation_fn=<MagicMock name='mock.ReLU' id='140325667718480'>, dropout=0)[source]

A relaxed one hot Categorical distribution conditioned on inputs via a dense network.

__init__(input_dim, final_dim, dense_hidden_dims=None, temperature=1.0, hidden_activation_fn=<MagicMock name='mock.ReLU' id='140325667718480'>, dropout=0)[source]

Init class.

Parameters

input_dim: int

the input size.

final_dim: int

the dimension of the random variable.

dense_hidden_dims: list of int, default None

the sizes of the hidden layers of the fully connected network used to condition the distribution on the inputs. If None, then the default is a single-layered dense network.

temperature: float, default 1

degree of how approximately discrete the distribution is. The closer to 0, the more discrete and the closer to infinity, the more uniform.

hidden_activation_fn: @callable, default relu

the activation function to use on the hidden layers of the fully connected network.

dropout: float, default 0

define the dropout rate.

forward(tensor_list)[source]

Creates a RelaxedOneHotCategorical distribution conditioned on the inputs.

Parameters

tensor_list: list of torch.Tensor

a list of tensors that will be first concatenatedd on the last dimension.

class pynet.models.vae.distributions.ConditionalNormal(input_dim, final_dim, dense_hidden_dims=None, sigma_min=0.0, raw_sigma_bias=0.25, hidden_activation_fn=<MagicMock name='mock.ReLU' id='140325667718480'>, dropout=0)[source]

A multivariate Normal distribution conditioned on inputs via a dense network.

__init__(input_dim, final_dim, dense_hidden_dims=None, sigma_min=0.0, raw_sigma_bias=0.25, hidden_activation_fn=<MagicMock name='mock.ReLU' id='140325667718480'>, dropout=0)[source]

Init class.

Parameters

input_dim: int

the input size.

final_dim: int

the dimension of the random variable.

dense_hidden_dims: list of int, default None

the sizes of the hidden layers of the fully connected network used to condition the distribution on the inputs. If None, then the default is a single-layered dense network.

sigma_min: float, default 0

the minimum standard deviation allowed.

raw_sigma_bias: float, default 0.25

a scalar that is added to the raw standard deviation output from the fully connected network. Set to 0.25 by default to prevent standard deviations close to 0.

hidden_activation_fn: @callable, default relu

the activation function to use on the hidden layers of the fully connected network.

dropout: float, default 0

define the dropout rate.

forward(tensor_list)[source]

Creates a Diag Multivariate Normal distribution conditioned on the inputs.

Parameters

tensor_list: list of torch.Tensor

a list of tensors that will be first concatenatedd on the last dimension.

class pynet.models.vae.distributions.Gaussian(input_dim, z_dim, sigma_min=0.0, raw_sigma_bias=0.25)[source]

Sample from a Gaussian distribution.

__init__(input_dim, z_dim, sigma_min=0.0, raw_sigma_bias=0.25)[source]

Initialize self. See help(type(self)) for accurate signature.

forward(x)[source]
reparameterize(mu, var)[source]

Follow us

© 2019, pynet developers .
Inspired by AZMIND template.