Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[nnx] Fix graph_utils bug #3518

Merged
merged 1 commit into from
Nov 30, 2023
Merged

[nnx] Fix graph_utils bug #3518

merged 1 commit into from
Nov 30, 2023

Conversation

cgarciae
Copy link
Collaborator

What does this PR do?

  • Fixes a bug in flatten/unflatten logic in graph_utils, Variables were not being copied which is a problem in new Reference semantics.

@cgarciae cgarciae changed the title Fix graph_utils bug [nnx] Fix graph_utils bug Nov 30, 2023
@@ -147,6 +147,9 @@ class _HashableMapping(tp.Mapping[HA, HB], tp.Hashable):
def __init__(self, mapping: tp.Mapping[HA, HB] | tp.Iterable[tuple[HA, HB]]):
self._mapping = dict(mapping)

def __contains__(self, key: object) -> bool:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this unrelated? I think Mapping implements __contains__ in terms of other dunder methods.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it does by calling getitem and catching a KeyError but that is super annoying for the debugger so I overwrote it.

@copybara-service copybara-service bot merged commit c0a2657 into main Nov 30, 2023
21 checks passed
@copybara-service copybara-service bot deleted the nnx-fix-graph-flatten branch November 30, 2023 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants