On the use of deep neural networks in optical communications