Convert model to cuda got error

Test code are attached, it seems that the layers inside self.features are not registered with nn.Module, what should I do to correct it?

Thanks for help!

import torch
class errNet(torch.nn.Module):
    def __init__(self, groups):
        ''' input: [batch, 10] output: [batch, 5] '''
        super(errNet, self).__init__()
        self.groups = groups
        self.features = [torch.nn.Linear(2,1) for i in range(self.groups)]
    def forward(self, x):
        res = [self.features[i](x[:,i*2:i*2+2]) for i in range(self.groups)]
        return, 1)
model = errNet(5)
x = torch.randn(3,10)
print('Test 1:', model(x).shape) # this is okay

device = torch.device("cuda:0")
model =
x =
print('Test 2:', model(x).shape) # error: model.features[i] is not cuda

Alright, I find the solution:
use torch.nn.ModuleList for self.features