For attributes to be registered as parameters, they need to be of type nn.Parameter or nn.Module. Either do
self.linear1 = nn.Linear(...)
self.linear2 = ...

or use nn.ModuleList 11
self.linear = nn.ModuleList([nn.Linear(...), ...])