Mean field limit in neural network learning : autoencoders and multilayer networks