Automatic Differentiation is Essential in Training Neural Networks for Solving Differential Equations