Energy stable neural network for gradient flow equations