How to train neural network a math multiplication table?
As your function is linear and you have a hidden size of 128, Your model might be suffering from overfitting. Try to lower the hidden layer to 2 or 4 and try to regularize the model using dropout. And also neural net requires a lot of data to train. With small data neural net does not perform well. So if you are unwilling to provide extra data ,you should go for linear model like linearRegressor from sklearn.It will do your task just fine with proper hyperparameter. But if you want to train a neural net then you have to provide a huge amount of data and also choose proper hidden size and regularizer.