Deep learning of stochastic contagion dynamics on complex networks