Skip to content

v0.4.0 — drop zuko runtime dependency

Choose a tag to compare

@xuda-ye-math xuda-ye-math released this 19 May 00:27

Highlights

zflows is now a standalone PyTorch package. The internals previously imported from zuko (Transform subclasses, MaskedMLP, the adaptive ODE solver, the vmap/grad plumbing) have been vendored into zflows.core/ and specialised for the unconditional setting only — every context / c=None argument is gone, so the only distribution a flow ever sees is the one fixed target.

The public API (zflows.flow, zflows.potential, zflows.loss, zflows.utils) and every flow constructor signature is unchanged; downstream code from v0.3.x keeps working with no edits.

Behavioural changes

  • NSF / NCSF parameterise their inner spline on per-coordinate $[-\text{halfwidth}_i, \text{halfwidth}_i]$ and wrap it with a translation-only AdditiveTransform sandwich (no scaling). The box geometry $[a, b]^d$ is honoured natively without distorting the conditioner's dynamic range.
  • MonotonicRQSTransform and CircularShiftTransform now accept a per-coordinate bound tensor, not just a scalar.
  • The Flow.t() -> ComposedTransform contract is preserved across NSF / NCSF / CNF / RealNVP.

Dependencies

  • Runtime: torch>=2.10.0, numpy>=2.4.0.
  • zuko is no longer required.

Verification

Two new correctness scripts ship under tests/:

  • tests/_verify_NSF_NCSF.py — 7 checks (round-trip, zeros() identity, call_and_ladj ≈ autograd slogdet, box preservation, CircularShift per-coord wrap, translation-sandwich invariant).
  • tests/_verify_CNF_RealNVP.py — 7 checks (round-trip, zeros() identity, slogdet agreement, RealNVP forward+inverse ladj cancellation, CNF Hutchinson unbiasedness, backprop coverage).

The end-to-end demos in tests/ all pass against this release.

🤖 Generated with Claude Code