Repository navigation
Fix triangular helpers for adjoint Cholesky factors on Julia 1.13 - #490
Merged
Merged
Conversation
The three removed rules name functions the extension never imports, so they only defined unused local functions. ReverseDiff 1.18.8 (JuliaDiff/ReverseDiff.jl#328) adds the method to `typeof(f)`, which requires `f` to exist, so loading fails with `UndefVarError`. Assisted-by: Claude Code <noreply@anthropic.com>
Distributions now prints `LogNormal()` as a multi-line block, so the doctests suppress that output instead of matching it. Assisted-by: Claude Code <noreply@anthropic.com>
ReverseDiff re-runs the `@grad` body on each forward pass of a recorded tape but keeps the pullback from recording time. Partials computed from tracked inputs in the body therefore raise `tape has finished recording` on ReverseDiff 1.18.4+, and partials computed in the body from any values are stale when a tape is replayed at a new input, as they already were before 1.18.4. Assisted-by: Claude Code <noreply@anthropic.com>
Reusing a tape through `find_alpha` at a new input raised a `MethodError` when some of its arguments were untracked, for example the inverse `PlanarLayer` with plain `Float64` parameters. ReverseDiff stores untracked inputs of a recorded call as plain values, but the `@grad` signature required `TrackedReal` for every argument. The tracking method needs no change: mixed arguments reach it through the promotion in `find_alpha(::Real, ::Real, ::Real)`. Assisted-by: Claude Code <noreply@anthropic.com>
On Julia 1.13, `Cholesky.U` of a factorisation stored as 'L' wraps
`factors'` without copying, so `parent(C.U)` is an `Adjoint`.
`upper_triangular` returned `convert(typeof(A), UpperTriangular(A))`,
but Julia cannot `convert` a triangular wrapper to an `Adjoint`, so it
threw a `MethodError`:
upper_triangular(parent(cholesky(Hermitian([2.0 1; 1 2], :L)).U))
`cholesky_upper` requests 'U' storage, so this surfaces only where
`cholesky` stores 'L' regardless: Mooncake forward mode does, so
`CorrBijector` and `VecCorrBijector` failed under it.
`lower_triangular` has the same latent defect for 'U'-stored factors.
Use `triu`/`tril` instead, which return a dense array for wrapper
types. A regression test covers both helpers.
Assisted-by: Claude Code <noreply@anthropic.com>
Contributor
|
Bijectors.jl documentation for PR #490 is available at: |
sunxd3
approved these changes
Nov 11, 2026
Member
|
@shravangoswami-bot review |
Contributor
|
Recommendation: Approve No blocking issue found in the reviewed source. Source review at f4f30f5. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Julia 1.13,
C.Uof a Cholesky factorisation stored as the lower triangle is a non-copyingUpperTriangular(C.factors')(JuliaLang/LinearAlgebra.jl#1186), soparent(C.U)is anAdjoint.upper_triangularusedconvert(typeof(A), UpperTriangular(A)), which cannot convert to anAdjoint, socholesky_upperthrows aMethodError:Mooncake's forward-mode
choleskyalways stores the lower triangle, soCorrBijectorandVecCorrBijectorfail under it; in CI this shows as threeVecCorrBijectorandcholesky_uppercases of the Mooncake integration tests on Julia 1.13.lower_triangularhas the same defect for factors stored as the upper triangle. Both helpers now usetriuandtril. Adds a regression test and a 0.16.4 HISTORY entry.Stacked on #489, which bumps to 0.16.4 and fixes the ReverseDiff extension and doctests that fail on
main.