Solved by mariosasko in post #4 
              
              
                When defining a model/layer (or even a loss function, activation) in PyTorch (Perceptron in your example), these models/layers should always subclass nn.Module and the forward method is sort of a special method in that case. Basically, it represents the forward pass of the input data. The reason why…