A Probabilistic Framework for Nonlinearities in Stochastic Neural Networks