Solution of Direct and Inverse Problems of Shaping of Optical Pulse by Machine Learning based Neural Network in Optical Communication