I have had the same error because I have been passing the input of the model directly to a nn.ModuleList object, instead of passing it through each of its contained modules.
So my original code looked like:
class Discriminator(nn.Module):
    
    def __init__(self, hidden_dim = 128, depth = 3, in_dim = 200):
        super(Discriminator, self).__init__()

        # parameter
        self.in_dim = in_dim

        # model arch.
        self.layers = nn.ModuleList([nn.Linear(in_dim, hidden_dim),
                                     nn.BatchNorm1d(hidden_dim),
                                     nn.LeakyReLU()])
        for i in range(0, depth-1):
            self.layers.extend([nn.Linear(hidden_dim//2**i,hidden_dim//2**(i+1)),
                                nn.BatchNorm1d(hidden_dim//2**(i+1)),
                                nn.LeakyReLU()])
        self.layers.extend([nn.Linear(hidden_dim//2**(depth-1), 1)])
    
    def forward(self, x):
        x = x.view(-1, self.in_dim)
        return self.layers(x)

And to fix it I just replaced the last line with the last line to:
    for layer in self.layers:
                x = layer(x)
            return x

In case this might help anyone in the future.