Diffusion Mechanism in Residual Neural Network: Theory and Applications