Created
April 10, 2024 06:07
-
-
Save anijain2305/cf8e44096a90cdb90b931cf8972a3b10 to your computer and use it in GitHub Desktop.
This file contains 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
import torch | |
from collections import OrderedDict | |
torch._dynamo.config.error_on_recompile = True | |
d = { | |
30: 4, | |
25: 2, | |
20: 1, | |
} | |
d = OrderedDict(d) | |
# This line causes the problem | |
d.move_to_end(30) | |
@torch.compile(backend="eager") | |
def fn(x, d): | |
return x * d[30] * d[25] | |
fn(torch.randn(4), d) | |
fn(torch.randn(4), d) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Run it with this cmd, it will fail
My debug prints show that odict_keys order is different from PyDict_Next