My model has a custom bias list like below. But it faced an error
nn.ModuleList([nn.Parameter(torch.randn(1, out_chs, 1, 1)) for _ in range(n_layers)])
-->
TypeError: torch.nn.parameter.Parameter is not a Module subclass
So I just declare as a list like this. But now it looks it is not affected by model.cuda()
. So how to pass the list of nn.Parameter
to gpu?
[nn.Parameter(torch.randn(1, out_chs, 1, 1)) for _ in range(n_layers)]
-->
didn't match because some of the arguments have invalid types: │ (torch.FloatTensor)