ray.rllib.core.learner.learner.Learner.get_optimizer#

Learner.get_optimizer(module_id: str = 'default_policy', optimizer_name: str = 'default_optimizer') torch.optim.Optimizer | tf.keras.optimizers.Optimizer[source]#

Returns the optimizer object, configured under the given module_id and name.

If only one optimizer was registered under module_id (or ALL_MODULES) via the self.register_optimizer method, optimizer_name is assumed to be DEFAULT_OPTIMIZER.

Parameters:
  • module_id – The ModuleID for which to return the configured optimizer. If not provided, will assume DEFAULT_MODULE_ID.

  • optimizer_name – The name of the optimizer (registered under module_id via self.register_optimizer()) to return. If not provided, will assume DEFAULT_OPTIMIZER.

Returns:

The optimizer object, configured under the given module_id and optimizer_name.