Skip to content

Bugfix/mutables leaves#2105

Merged
fehiepsi merged 2 commits intopyro-ppl:masterfrom
esennesh:bugfix/mutables_leaves
Dec 14, 2025
Merged

Bugfix/mutables leaves#2105
fehiepsi merged 2 commits intopyro-ppl:masterfrom
esennesh:bugfix/mutables_leaves

Conversation

@esennesh
Copy link
Contributor

When employing NNX or other neural-network frameworks, we can sometimes get empty PyTrees of supposed mutable-state passed around. Since these contain no tensors at all, they should be detected as empty and, in my opinion at least, it's helpful to go down code paths with these that might sometimes require not having mutables.

Signed-off-by: Eli Sennesh <elisennesh@gmail.com>
…check

Signed-off-by: Eli Sennesh <elisennesh@gmail.com>
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@tillahoffmann
Copy link
Collaborator

Thanks for sharing! Do you have an example handy where this is causing trouble?

@esennesh
Copy link
Contributor Author

Thanks for sharing! Do you have an example handy where this is causing trouble?

The notebook commit I include hits the code-path, but if you'd like one that has severe problems without this patch, I can write a notebook.

@fehiepsi
Copy link
Member

Thanks @esennesh!

@fehiepsi fehiepsi merged commit 1e7d986 into pyro-ppl:master Dec 14, 2025
9 checks passed
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.

3 participants