Skip to content
fn

realnvp_cifar

→RealNVPModel
realnvp_cifar(pretrained: bool = False, overrides: object = {})

Construct the RealNVP flow for the CIFAR-10 setup.

Paper-faithful CIFAR-10 configuration from Dinh et al., 2016 §4.1: 32 x 32 RGB, coupling networks of 8 residual blocks with 64 feature maps, and — unlike every other experiment — only a single downscale, so the flow keeps working at 16 x 16 rather than recursing to 4 x 4.

Model Size

Parameters

pretrainedbool= False
No checkpoint is published for realnvp_cifar, so True raises NotImplementedError rather than return randomly initialised weights.
**overridesobject= {}
Optional RealNVPConfig field overrides forwarded into the underlying config.

Returns

RealNVPModel

Bare bijection configured with the CIFAR-10 setup and any overrides.

Notes

Reference: Dinh, Sohl-Dickstein, and Bengio, "Density Estimation Using Real NVP", ICLR, 2017 (arXiv:1605.08803), §4.1 and Table 1. Reported test result: 3.49 bits/dim, with horizontal-flip augmentation and the alpha = 0.05 logit preprocessing this model applies internally.

Examples

>>> import lucid
>>> from lucid.models.generative.realnvp import realnvp_cifar
>>> model = realnvp_cifar().eval()
>>> x = lucid.rand((1, 3, 32, 32))
>>> model.bits_per_dim(x).shape
(1,)

Used by 1