Which Neural Net Architectures Give Rise to Exploding and Vanishing Gradients?