Repository navigation
Fix rectangular batch-repeat matrix multiplication - #157
Open
DiadkoShmek wants to merge 1 commit into
Open
DiadkoShmek wants to merge 1 commit into
DiadkoShmek wants to merge 1 commit into
Conversation
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.
Problem
Batch-repeated rectangular operators multiply the unrepeated base directly, so repeating a non-singleton batch can raise a batch-size mismatch even when dense Torch multiplication is valid:
Change
Use the existing repeat-batches-to-columns algorithm for rectangular multiplication as well. Fold the broadcast input shape
(..., N, C), apply the base operator, then unfold the output shape(..., M, C). Explicit column sizes retain empty products, and vector normalization preserves direct vector calls. This retains structured/factorized multiplication without materializing the repeated matrix.Validation
git diff --checkpasses.CPU Python 3.13.7 / Torch 2.11 only; no full-repository, documentation or GPU/version-matrix run. Existing generic zero-width/broadcast RHS gradient and batched-vector autograd limitations are unchanged and reproduced separately with plain
DenseLinearOperator.AI assistance: OpenAI Codex investigated, implemented and independently reviewed this fix. No human review or upstream approval is claimed.