- 报错:
AttributeError: cannot assign module before Module.__init__() call
- 错误代码:
class ModuleDict(nn.Module):
def __init__(self, choice, act):
self.choice=choice
self.act = act
self.choices = nn.ModuleDict({
'conv1':nn.Conv2d(10, 10, 3),
'conv2':nn.Conv2d(10, 20, 3),
})
self.pool = nn.MaxPool2d(2)
sel