Implemented forward propagation for the neural network.