Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_train_step_accumulator(self):
"""Return the train step accumulator.
By default, the accumulator stores and retrieves the first
value from the optimizer call. Most optimizers make only one
call, so first value is at the same time the only value.
In case of some optimizers, e.g. LBFGS,
``train_step_calc_gradient`` is called multiple times, as the
loss function is evaluated multiple times per optimizer
call. If you don't want to return the first value in that
case, override this method to return your custom accumulator.
"""
return FirstStepAccumulator()
def get_train_step_accumulator(self):
"""Return the train step accumulator.
By default, the accumulator stores and retrieves the first
value from the optimizer call. Most optimizers make only one
call, so first value is at the same time the only value.
In case of some optimizers, e.g. LBFGS,
``train_step_calc_gradient`` is called multiple times, as the
loss function is evaluated multiple times per optimizer
call. If you don't want to return the first value in that
case, override this method to return your custom accumulator.
"""
return FirstStepAccumulator()