Machine Learning for Long-Distance Quantum Communication