Artificial neural networks for cosmic gamma-ray propagation in the universe