This repository was archived by the owner on Aug 1, 2025. It is now read-only.

Description
🐛 Describe the bug
class Foo(torch.nn.Module):
a = 4
def __init__(self):
super().__init__()
def forward(self, x):
return x.cos() + self.a
torchdynamo.config.dynamic_shapes = True
torchdynamo.export(Foo(), torch.randn(3, 4), aten_graph=True)
Error logs
File "/mnt/xarfuse/uid-23137/7756fc57-seed-nspid4026533012_cgpid17879168-ns-4026533009/torchdynamo/symbolic_convert.py", line 308, in step
getattr(self, inst.opname)(inst)
File "/mnt/xarfuse/uid-23137/7756fc57-seed-nspid4026533012_cgpid17879168-ns-4026533009/torchdynamo/symbolic_convert.py", line 805, in LOAD_ATTR
result = BuiltinVariable(getattr).call_function(
File "/mnt/xarfuse/uid-23137/7756fc57-seed-nspid4026533012_cgpid17879168-ns-4026533009/torchdynamo/variables/builtin.py", line 337, in call_function
result = handler(tx, *args, **kwargs)
File "/mnt/xarfuse/uid-23137/7756fc57-seed-nspid4026533012_cgpid17879168-ns-4026533009/torchdynamo/variables/builtin.py", line 661, in call_getattr
return obj.var_getattr(tx, name).add_options(options)
File "/mnt/xarfuse/uid-23137/7756fc57-seed-nspid4026533012_cgpid17879168-ns-4026533009/torchdynamo/variables/nn_module.py", line 153, in var_getattr
unimplemented(f"class property {typestr(base)} {typestr(subobj)}")
File "/mnt/xarfuse/uid-23137/7756fc57-seed-nspid4026533012_cgpid17879168-ns-4026533009/torchdynamo/exc.py", line 71, in unimplemented
raise Unsupported(msg)
torchdynamo.exc.Unsupported: class property Foo int
Did Dynamo succeed?
Did AOT succeed?
Did Inductor succeed?
Minified repro
Repro above