Skip to content

ENH: Add 1D convolutional flows (ConvFlow1d). - #13

Merged
ntustison merged 1 commit into
mainfrom
1DStuff
Sep 27, 2026
Merged

ntustison merged 1 commit into
mainfrom
1DStuff

Conversation

@ntustison

Copy link
Copy Markdown
Member

Normalizing flows for multichannel sequences of shape (B, C, L), e.g. 2D keypoint trajectories over a gait cycle.

New components:

  • nets.ConvNet1d: 1D conv subnet (zero-init last layer, optional ActNorm, configurable padding_mode).
  • flows.Invertible1x1Conv1d: LU-parameterized invertible 1x1 conv for NCL tensors (log-det scaled by L), reusing the existing guardrails.
  • flows.CouplingBlock1d: channel-split affine coupling with bounded log-scales (s_cap * tanh) and optional shift cap.
  • flows.GlowBlock1d: ActNorm -> Invertible1x1Conv1d -> coupling, with configurable kernel_size and the same nan/gen_clamp guards as 2D/3D.
  • ConvFlow1d: single-scale stack of K coupling or Glow blocks over a DiagGaussian((C, L)) base.
  • Permute(mode="reverse").

Design notes:

  • padding_mode="circular" makes the couplings equivariant to circular time shifts (periodic signals); default stays "zeros" as in 2D/3D.
  • actnorm_s_cap (default 5.0) is decoupled from scale_cap (0.5) so ActNorm can standardize unscaled inputs.
  • ConvFlow1d.sample() accepts temperature (as MultiscaleFlow.sample) and restores the base temperature afterwards.

Tests perturb all weights (zero-init couplings are otherwise the identity) and check, in float64, non-trivial transforms, round trips, log-det against the autograd Jacobian, log_prob consistency, circular equivariance, ActNorm standardization and tempered sampling.

Normalizing flows for multichannel sequences of shape (B, C, L), e.g.
2D keypoint trajectories over a gait cycle.

New components:
* nets.ConvNet1d: 1D conv subnet (zero-init last layer, optional
  ActNorm, configurable padding_mode).
* flows.Invertible1x1Conv1d: LU-parameterized invertible 1x1 conv for
  NCL tensors (log-det scaled by L), reusing the existing guardrails.
* flows.CouplingBlock1d: channel-split affine coupling with bounded
  log-scales (s_cap * tanh) and optional shift cap.
* flows.GlowBlock1d: ActNorm -> Invertible1x1Conv1d -> coupling, with
  configurable kernel_size and the same nan/gen_clamp guards as 2D/3D.
* ConvFlow1d: single-scale stack of K coupling or Glow blocks over a
  DiagGaussian((C, L)) base.
* Permute(mode="reverse").

Design notes:
* padding_mode="circular" makes the couplings equivariant to circular
  time shifts (periodic signals); default stays "zeros" as in 2D/3D.
* actnorm_s_cap (default 5.0) is decoupled from scale_cap (0.5) so
  ActNorm can standardize unscaled inputs.
* ConvFlow1d.sample() accepts temperature (as MultiscaleFlow.sample)
  and restores the base temperature afterwards.

Tests perturb all weights (zero-init couplings are otherwise the
identity) and check, in float64, non-trivial transforms, round trips,
log-det against the autograd Jacobian, log_prob consistency, circular
equivariance, ActNorm standardization and tempered sampling.
@ntustison
ntustison merged commit 1a8d344 into main Sep 27, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant