Solved by ptrblck in post #2 
              
              
                Usually you would create a model containing all layers. If you then call model(inputs), the forward pass will be executed (in your case with the linear layer and dropout). If your model is quite simple, you could use nn.Sequential, otherwise you would just write a custom nn.Module. 
In your example …