On approximating ∇f with neural networks