Skip to content

Preserve batched vector inverse quadratic forms in diagonal operators - #140

Open
AHMETHAKANBEZIR1 wants to merge 1 commit into
cornellius-gp:mainfrom
AHMETHAKANBEZIR1:fix/diag-vector-inv-quad
Open

AHMETHAKANBEZIR1 wants to merge 1 commit into
cornellius-gp:mainfrom
AHMETHAKANBEZIR1:fix/diag-vector-inv-quad

Conversation

@AHMETHAKANBEZIR1

Copy link
Copy Markdown

Summary

Fixes #139. A vector RHS has no RHS-column axis remaining after its quadratic form has been computed. Avoid applying column reduction when rhs_batch_shape is empty, preserving each independent batch result for both DiagLinearOperator and inherited ConstantDiagLinearOperator.

For example, diagonal and RHS torch.arange(1,11).reshape(2,5) previously returned scalar55 with the default reduction, instead of [15,40], while its log determinant still had batch shape (2,). Matrix RHS column reduction remains unchanged. This does not change generic RHS broadcasting policy or materialize dense matrices in production.

Regression and verification

  • New unittest method contains 96 subcases across both operator classes, float32/64, unbatched/one/multiple/singleton batch dimensions, vector/one-column/three-column RHS, both reduction settings.
  • Independent dense torch.linalg.solve and slogdet reference checks exact output shape, values and weighted gradients of diagonal parameters and RHS. Clean main 1c5e24b:12 failures and84 controls pass; after the fix all96 pass.
  • Windows / Python3.12.14 / PyTorch2.10CPU: full python -m unittest:5047 tests pass.
  • Windows / Python3.14.6 / PyTorch2.13CPU: new96-subcase regression passes.
  • All15 configured pre-commit hooks pass or have no applicable files, including full flake8/ufmt/ASCII; git diff --check passes.
  • Full sphinx-build -W -b html succeeds. No new API/docstring.
  • No CUDA/MPS/Inductor or other dependency matrix was run.

The pre-commit cache's installed Windows ASCII launcher had already been repaired to use forward slashes in its shebang; the validation code and repository hook configuration are unchanged, with no hook bypass.

Prepared autonomously with OpenAI Codex at the account owner's request; no independent human review is claimed. Reproduction, independent references and tests were run locally. Codex is recorded as commit co-author.

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.

Batched vector inv_quad_logdet collapses a batch axis with default reduction

1 participant