Skip to content

Include broadcast bounds in Truncated batch shape - #82

Closed
ktz03 wants to merge 1 commit into
probabilists:masterfrom
ktz03:fix/truncated-batch-shape
Closed

ktz03 wants to merge 1 commit into
probabilists:masterfrom
ktz03:fix/truncated-batch-shape

Conversation

@ktz03

@ktz03 ktz03 commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Fixes #81.

Truncated reports only its base distribution's batch shape, even when broadcast bounds add batch dimensions. Its samples then disagree with that shape, and composing it with Joint or Mixture fails.

Return the internal uniform distribution's batch shape, which already incorporates both bounds and the base CDF parameters. Add regressions for scalar and batched bases, broadcast lower/upper bounds, expansion, and both composition paths.

Validation on Windows, Python 3.12.14, PyTorch 2.14.1+cpu:

  • Same 171-test suite: baseline 7 failed / 164 passed; fixed 171 passed with the default float64 setting.
  • The same 171 tests also pass with --dtype=float32; these are overlapping executions.
  • pytest zuko --doctest-modules: 28 passed.
  • Ruff 0.9.9 lint and formatting, sdist and wheel builds pass.

No CUDA, Linux, other Python/PyTorch versions, training, or performance validation was run.

@francois-rozet

Copy link
Copy Markdown
Member

Hi @ktz03, thank you for the issue report and the PR fix! It looks like a sensible fix. I will merge it soon, maybe trimming the tests slightly.

@francois-rozet

francois-rozet commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

I couldn't edit your branch in place, so I had to fork it. #83 is now merged, thank you for your contribution!

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.

Truncated ignores batch dimensions introduced by bounds

2 participants