Optimizing Functionals on the Space of Probabilities with Input Convex Neural Networks