I noticed a graph break when using {"a": torch.ones(42)} | {"b": torch.ones(43)}
, but none when using {...}.update({...})
.
Example code
import torch
# works
@torch.compile(fullgraph=True)
def f():
a = {"one": torch.ones(5)}
a.update({"two": torch.ones(4)})
return a
f()
# doesn't work, raises
# Unsupported: call_function BuiltinVariable(or_) [ConstDictVariable(), ConstDictVariable()] {}
@torch.compile(fullgraph=True)
def f():
return {"one": torch.ones(5)} | {"two": torch.ones(4)}
f()
This leaves me with a number of questions,
- should this work, or what is problematic about this
- Is there a spec that explains which features of python should be supported and which are expected to introduce breaks?
I’ve done my best to search the github issues, docs and tutorials, but came up empty handed.