-
Notifications
You must be signed in to change notification settings - Fork 26.2k
Open
Labels
oncall: jitAdd this issue/PR to JIT oncall triage queueAdd this issue/PR to JIT oncall triage queue
Description
🐛 Describe the bug
import torch
import torch.nn as nn
class MyModule(nn.Module):
def __init__(self):
super(MyModule, self).__init__()
self.seq = nn.Sequential(
nn.Linear(10, 20),
nn.ReLU(),
nn.Linear(20, 5)
)
def forward(self, x):
return self.seq(x)
my_module = MyModule()
scripted_module = torch.jit.script(my_module)
RuntimeError:
Module 'Sequential' has no attribute '_modules' :
File "/home/zhou/.local/lib/python3.10/site-packages/torch/nn/modules/container.py", line 251
@property
def modules(self):
return self._modules
~~~~~~~~~~~~~ <--- HERE
Versions
version = '2.0.0+cu117'
debug = False
cuda = '11.7'
git_version = 'c263bd43e8e8502d4726643bc6fd046f0130ac0e'
hip = None
Metadata
Metadata
Assignees
Labels
oncall: jitAdd this issue/PR to JIT oncall triage queueAdd this issue/PR to JIT oncall triage queue