Deep neural networks from the perspective of ergodic theory