This is a dumb mistake. I wrongly return x instead of output in the forward function. The resulting model could successfully approximate the sine function. As could be seen below, the prediction could perfectly match the sine curve in validation data.