Repository navigation
Keep the indexed dat alive in the adjoint interpolation weight loop - #5785
Open
sghelichkhani wants to merge 1 commit into
Open
sghelichkhani wants to merge 1 commit into
sghelichkhani wants to merge 1 commit into
Conversation
For a Real target space the indexed dat in _loop_target_nodes has no loop index, so the assignment kept only a weak reference to it. The garbage collector could free the dat before the eager loop ran, which raised a dead weakref error in the adjoint of an interpolation into R.
This branch has not been deployed
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.
The adjoint weight of an interpolation into a Real space is computed with an assignment that keeps only a weak reference to a temporary indexed dat, so the loop fails if the garbage collector frees the temporary first. This passes
_weakref=Falsein_loop_target_nodes, as the sparsity loop infiredrake/assemble.pyalready does. The new test makes the collector run very often and fails on main every time.Fixes #5783
AI-assisted with Claude Code.