NICEConfig
NormalizingFlowConfigNICEConfig(sample_size: int | tuple[int, int] = 32, in_channels: int = 3, out_channels: int = 3, act_fn: GenerativeActivation = 'relu', prior: FlowPrior = 'logistic', input_dim: int = 784, num_coupling_layers: int = 4, num_hidden_layers: int = 5, hidden_dim: int = 1000, input_reorder: Literal['tile', 'none'] = 'tile', init_range: float = 0.01)Configuration for every NICE variant.
Defaults reproduce the paper's MNIST experiment (Figure 3): 784 dimensions, four coupling layers whose coupling networks have five hidden layers of 1000 rectified units, and a standard logistic prior.
Args:
input_dim: Dimensionality D of the data the flow is defined
on — the paper's "# dimensions" row and the released
configs' nvis. Figure 3: 784 (MNIST), 2304
(TFD), 3072 (SVHN, CIFAR-10). Must be even, since every
coupling layer splits it in half.
num_coupling_layers: Number of stacked additive coupling layers.
The paper uses 4 for every dataset; three is the minimum
that lets all dimensions interact.
num_hidden_layers: Hidden layers inside each coupling network
m. Paper Figure 3: 5 for MNIST, 4 for TFD /
SVHN / CIFAR-10.
hidden_dim: Units per hidden layer of m. Paper Figure 3:
1000 (MNIST), 5000 (TFD), 2000 (SVHN,
CIFAR-10).
input_reorder: One-off permutation applied before the first
coupling layer. "tile" (default) reproduces the paper's
odd/even partition; "none" splits in raster order, which
is what the released configs for SVHN / CIFAR-10 do.
init_range: Half-width of the uniform weight initialisation of
every coupling network, matching the official release's
irange = 0.01. Biases start at zero, and the diagonal
scaling starts at s = 0 (identity).
Notes:
NICE is defined on flat D-vectors, not on a pixel grid: both
the paper and the released configs parametrise each experiment by
a single dimension count. input_dim is therefore the only
dimensional knob, and the spatial fields inherited from
GenerativeModelConfig (sample_size, in_channels,
out_channels) are pinned to the equivalent vector encoding
rather than to an image shape the sources never state.
Examples
>>> from lucid.models.generative.nice._config import NICEConfig
>>> cfg = NICEConfig()
>>> cfg.model_type
'nice'
>>> cfg.in_channels
1Used by 3
Constructors
1__init__
→None__init__(sample_size: int | tuple[int, int] = 32, in_channels: int = 3, out_channels: int = 3, act_fn: GenerativeActivation = 'relu', prior: FlowPrior = 'logistic', input_dim: int = 784, num_coupling_layers: int = 4, num_hidden_layers: int = 5, hidden_dim: int = 1000, input_reorder: Literal['tile', 'none'] = 'tile', init_range: float = 0.01)