forward training a neural network