-
Story
-
Resolution: Unresolved
-
Undefined
-
None
-
None
-
-
- 🐛 Describe the bug
-
```python
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch._inductor import config
config.fallback_random = True
torch.set_grad_enabled(False)
torch._dynamo.config.capture_scalar_outputs = True
class Model(nn.Module):
def _init_(self):
super()._init_()
self.lazy_fc = nn.LazyLinear(out_features=128)
def forward(self, x):
x = self.lazy_fc![]()
return x
model = Model()
x = torch.randn(1, 28, 28)
inputs = [x]
device = "cpu"
def run_test(model, inputs, device, backend):
torch.manual_seed(0)
model.to(device)
inputs = [input.to(device) for input in inputs]
if backend != "eager":
model = torch.compile(model, backend=backend, dynamic=True)
try:
output = model(*inputs)
print(f"succeed on
")
except Exception as e:
print(e)
run_test(model, inputs, device, 'aot_eager')
run_test(model, inputs, device, 'eager')
```
If we first use eager to initialize lazylinear (i.e., swap the position of the last two lines of code), dynamo can catch `in_features` and run successfully.
-
-
- Error logs
-
```
RuntimeError: /pytorch/build/aten/src/ATen/RegisterCPU_1.cpp:2512: SymIntArrayRef expected to contain only concrete integers
succeed on eager
```
-
-
- Versions
-
2.10.0.dev20251103+cu126
cc @chauhang @penguinwu