Calculates output layer error.