Solved by vaasudev96 in post #2 
              
              
                Changing torch::mse_loss to torch::nn::functional::mse_loss should make it work. 
mse_loss is defined under torch::nn::functional namespace. 
https://pytorch.org/cppdocs/api/function_namespacetorch_1_1nn_1_1functional_1aba6a5341298f43163c046b3dd50dc6ce.html#function-torch-nn-functional-mse-loss