Skip to content

Fix FillDiagonalOffset.grad for complex dtypes#1950

Open
WHOIM1205 wants to merge 1 commit intopymc-devs:mainfrom
WHOIM1205:fix-fill-diagonal-offset-grad-complex
Open

Fix FillDiagonalOffset.grad for complex dtypes#1950
WHOIM1205 wants to merge 1 commit intopymc-devs:mainfrom
WHOIM1205:fix-fill-diagonal-offset-grad-complex

Conversation

@WHOIM1205
Copy link
Contributor

Fix: Correct gradient length for FillDiagonalOffset with complex inputs

Bug

FillDiagonalOffset.grad returned only 2 gradient entries in the complex-dtype early-exit path, even though the Op has 3 inputs (a, val, offset).

This caused an opaque AssertionError inside the gradient machinery when users attempted to compute gradients with complex matrices.

Fix

Updated the complex branch in pytensor/tensor/extra_ops.py:

- return [None, None]
+ return [None, None, None]

Signed-off-by: WHOIM1205 <rathourprateek8@gmail.com>
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.

1 participant