List is not a Module subclass with bn_drop_lin

Hi family, in new using fastai and i have some troubles coding. Here is my code:

In the last lane of code i got this error
TypeError: list is not a Module subclass

What’s im doing wrong?

bn_drop_lin returns a list of layers and nn.Sequential needs layers seperated by ,. You can use:

model = nn.Sequential(
    # layers
    *bn_drop_lin(512, 3, True, 0.5)

Just add a *.

1 Like

But for instance conv_layer also return a list. Why its working without *?

conv_layer returns nn.Sequential layer which has layers inside it but bn_drop_lin returns a list. Check the source code on github.

1 Like