Solving partial differential equations with sampled neural networks