neural_ode(pretrained: bool = False, overrides: object = {})Construct the Neural ODE continuous normalizing flow.
A single vector field integrated from t = 0 to t = 1, with the
log-density carried alongside it by the instantaneous change of
variables. Depth is not a hyper-parameter: lucid.diffeq spends
as many evaluations as the requested tolerance needs, and nfe
reports how many that was.
Model Size
Parameters
pretrainedbool= False**overridesobject= {}NeuralODEConfig field overrides forwarded into
the underlying config.Returns
NeuralODEModelBare flow configured with the paper's field and any overrides.
Notes
Reference: Chen, Rubanova, Bettencourt, and Duvenaud, "Neural Ordinary Differential Equations", NeurIPS, 2018 (arXiv:1806.07366), §4. The paper's own continuous-flow experiments are two-dimensional density matching, where the trace of the Jacobian is summed exactly; at the image shape this factory defaults to, the same flow switches to the Hutchinson estimator of Grathwohl et al. (FFJORD, ICLR 2019), which is what makes the cost independent of the dimension.
Examples
>>> import lucid
>>> from lucid.models.generative.neural_ode import neural_ode
>>> model = neural_ode(sample_size=(1, 2), in_channels=1,
... out_channels=1).eval()
>>> z, log_det = model.encode(lucid.rand((2, 1, 1, 2)))
>>> z.shape, log_det.shape
((2, 2), (2,))
>>> model.trace_method # two-dimensional, so exact
'exact'