Skip to content

Conversation

@StrongerXi
Copy link
Contributor

@StrongerXi StrongerXi commented Oct 30, 2024

Stack from ghstack (oldest at bottom):

This patch adds 2 simple methods VariableTracker.is_mutable() and
VariableTracker.is_immutable(), which helps clarify intention. For
instance, rather than writing

if var.mutation_type:
    ...

After this patch one can write

if var.is_mutable():
    ...

This patch also simplifies mutation_type propagation in some
ListVariable methods.

cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @chenyang78 @kadeng @chauhang @amjames

[ghstack-poisoned]
@pytorch-bot
Copy link

pytorch-bot bot commented Oct 30, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/139341

Note: Links to docs will display an error until the docs builds have been completed.

✅ You can merge normally! (1 Unrelated Failure)

As of commit 4ccd9c8 with merge base b82a51b (image):

FLAKY - The following job failed but was likely due to flakiness present on trunk:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

StrongerXi added a commit that referenced this pull request Oct 30, 2024
…Tracker`

This patch adds 2 simple methods `VariableTracker.is_mutable()` and
`VariableTracker.is_immutable()`, which helps clarify intention. For
instance, rather than writing
```python
if var.mutation_type:
    ...
```
After this patch one can write
```python
if var.is_mutable():
    ...
```

This patch also simplifies `mutation_type` propagation in some
`ListVariable` methods.

ghstack-source-id: d8954a3
Pull Request resolved: #139341
[ghstack-poisoned]
StrongerXi added a commit that referenced this pull request Oct 31, 2024
…Tracker`

This patch adds 2 simple methods `VariableTracker.is_mutable()` and
`VariableTracker.is_immutable()`, which helps clarify intention. For
instance, rather than writing
```python
if var.mutation_type:
    ...
```
After this patch one can write
```python
if var.is_mutable():
    ...
```

This patch also simplifies `mutation_type` propagation in some
`ListVariable` methods.

ghstack-source-id: 289e2a9
Pull Request resolved: #139341
@StrongerXi StrongerXi added the topic: not user facing topic category label Nov 4, 2024

def is_mutable(self):
"""Whether Dynamo allows mutation on this variable."""
return self.mutation_type
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit - return self.mutation_type is not None?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call, updating.

[ghstack-poisoned]
StrongerXi added a commit that referenced this pull request Nov 5, 2024
…Tracker`

This patch adds 2 simple methods `VariableTracker.is_mutable()` and
`VariableTracker.is_immutable()`, which helps clarify intention. For
instance, rather than writing
```python
if var.mutation_type:
    ...
```
After this patch one can write
```python
if var.is_mutable():
    ...
```

This patch also simplifies `mutation_type` propagation in some
`ListVariable` methods.

ghstack-source-id: d252122
Pull Request resolved: #139341
@StrongerXi
Copy link
Contributor Author

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Nov 5, 2024
@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

pobin6 pushed a commit to pobin6/pytorch that referenced this pull request Dec 5, 2024
…Tracker` (pytorch#139341)

This patch adds 2 simple methods `VariableTracker.is_mutable()` and
`VariableTracker.is_immutable()`, which helps clarify intention. For
instance, rather than writing
```python
if var.mutation_type:
    ...
```
After this patch one can write
```python
if var.is_mutable():
    ...
```

This patch also simplifies `mutation_type` propagation in some
`ListVariable` methods.

Pull Request resolved: pytorch#139341
Approved by: https://github.com/mlazos, https://github.com/anijain2305
ghstack dependencies: pytorch#139339, pytorch#139340
@github-actions github-actions bot deleted the gh/StrongerXi/15/head branch December 6, 2024 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants