Skip to content

Fix SoftAsymmetricLaplace batch expansion - #3489

Open
AHMETHAKANBEZIR1 wants to merge 1 commit into
pyro-ppl:devfrom
AHMETHAKANBEZIR1:fix/soft-asymmetric-expand
Open

AHMETHAKANBEZIR1 wants to merge 1 commit into
pyro-ppl:devfrom
AHMETHAKANBEZIR1:fix/soft-asymmetric-expand

Conversation

@AHMETHAKANBEZIR1

Copy link
Copy Markdown

Proposed changes

Fixes #3488. SoftAsymmetricLaplace.expand() refers to AsymmetricLaplace in both _get_checked_instance and super(). This raises NotImplementedError during ordinary batch expansion and pyro.plate broadcasting. Replace both references with SoftAsymmetricLaplace; parameter expansion, cached-property behavior and the validation flag follow the existing method.

New and existing tests

One focused regression covers scalar, singleton and batched inputs for both soft and hard AsymmetricLaplace distributions. It requires direct expansion to succeed, preserve the actual class, density, variance, sample shape and softness. The hard class is an unchanged control.

  • Before the fix on dev ae65fa4: 3 failures / 3 controls, with the soft distribution cases raising NotImplementedError.
  • After the fix on both Python 3.12/PyTorch 2.10 CPU and Python 3.14/PyTorch 2.13 CPU: 110 passed, 4 skipped, 4 xfailed in the complete selected AsymmetricLaplace/SoftAsymmetricLaplace generic distribution cases plus the added regression (2546 unrelated cases deselected). Existing skipped/unsupported cases were not altered.
  • A real pyro.plate trace with five samples now succeeds, keeps the SoftAsymmetricLaplace class and agrees with the original distribution's log density. This is a smoke check, not a full inference benchmark.
  • Full repository Ruff check, format check across 630 files, UTF-8 copyright-header check and mypy across 553 source files pass. git diff --check passes.
  • Focused Sphinx autodoc build of both public asymmetric Laplace classes passes with warnings treated as errors. Docstrings are unchanged.
  • Not run: full package tests, full project docs/tutorials, GPU, compilation or real inference/training benchmarks. This does not address the separate log(erfc) numerical limitations documented for SoftAsymmetricLaplace.

AI assistance disclosure

This contribution was investigated, implemented and validated autonomously with Codex assistance on behalf of AHMETHAKANBEZIR1. It has not received independent human code review. Codex is recorded as a co-author. Maintainer review is requested; local evidence is not a claim of upstream CI success.

Preserve the soft distribution constructor and semantics when expanding
the batch shape, including normal plate broadcasting.

Co-authored-by: Codex <noreply@openai.com>

This branch has not been deployed

No deployments
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.

SoftAsymmetricLaplace.expand uses the wrong distribution class

1 participant