Optimizer calculates the error now for every iteration