-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Closed
Closed
Copy link
Labels
module: dynamotriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module
Description
🐛 Describe the bug
Reference: #114947 (comment)
Dynamo does not support dict.fromkeys(iterable, value=None, /) yet, which is a classmethod for dict.
I can temporarily replace this to:
- dict.fromkeys(iterable, value)
+ {k: value for k in iterable}
- dict.fromkeys(iterable)
+ {k: None for k in iterable}But in general, we may need to implement a special path for it in BuiltinVariable.call_function.
The error:
torch._dynamo.exc.Unsupported: call_method BuiltinVariable(dict) fromkeys [ConstDictVariable()] {}
A minimal script to reproduce:
from collections import OrderedDict, defaultdict
import torch
def fn() -> None:
d = dict.fromkeys(['a', 'b'])
od = OrderedDict.fromkeys(['a', 'b'])
dd = defaultdict.fromkeys(['a', 'b'])
comp_out = torch._dynamo.optimize(nopython=True)(fn)()The error for statement d = dict.fromkeys(['a', 'b']):
torch._dynamo.exc.Unsupported: call_method BuiltinVariable(dict) fromkeys [ListVariable()] {}
The error for statement od = OrderedDict.fromkeys(['a', 'b']) / dd = defaultdict.fromkeys(['a', 'b']):
torch._dynamo.exc.Unsupported: call_method SkipFilesVariable() fromkeys [ListVariable()] {}
Versions
main branch
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @chenyang78 @aakhundov @kadeng
Metadata
Metadata
Assignees
Labels
module: dynamotriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module