-
Notifications
You must be signed in to change notification settings - Fork 24.8k
[dynamo] Initial support for nonstrict_trace
#146367
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
Changes from 1 commit
a389c1a
3225172
44ad899
4fc9b4d
ceff0c9
904196b
021ddb6
2236b90
c7f08cb
68a71b5
5dd522f
290dd13
dcb8643
523df2c
7f34954
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
[ghstack-poisoned]
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -964,11 +964,16 @@ def unflatten(self, leaves: Iterable[Any]) -> PyTree: | |
return unflatten_fn(child_pytrees, self.context) | ||
|
||
|
||
@dataclasses.dataclass(frozen=True, repr=False) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this affect the inherited There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks for checking |
||
class LeafSpec(TreeSpec): | ||
def __init__(self) -> None: | ||
super().__init__(None, None, []) | ||
type: Any = dataclasses.field(default=None, init=False) | ||
context: Context = dataclasses.field(default=None, init=False) | ||
children_specs: list["TreeSpec"] = dataclasses.field( | ||
default_factory=list, init=False | ||
) | ||
|
||
def __post_init__(self) -> None: | ||
# Override `__post_init__` for `num_leaves` derivation. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Basically making There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you explain a bit more why we needed to change LeafSpec? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, so without this change, the implementation in
Specifically, in the old So we could either
Lmk what you think, I have no strong preference here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SGTM |
||
object.__setattr__(self, "num_nodes", 1) | ||
object.__setattr__(self, "num_leaves", 1) | ||
object.__setattr__(self, "num_children", 0) | ||
|
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This chunk is just refactoring name generation into this call.