ray.rllib.core.learner.learner.Learner.filter_param_dict_for_optimizer
ray.rllib.core.learner.learner.Learner.filter_param_dict_for_optimizer#
- Learner.filter_param_dict_for_optimizer(param_dict: Dict[Hashable, Union[torch.Tensor, tensorflow.python.ops.variables.Variable]], optimizer: Union[torch.optim.optimizer.Optimizer, keras.optimizers.optimizer_experimental.optimizer.Optimizer]) Dict[Hashable, Union[torch.Tensor, tensorflow.python.ops.variables.Variable]][source]#
Reduces the given ParamDict to contain only parameters for given optimizer.
- Parameters
param_dict – The ParamDict to reduce/filter down to the given
optimizer. The returned dict will be a subset ofparam_dictonly containing keys (param refs) that were registered together withoptimizer(and thus thatoptimizeris responsible for applying gradients to).optimizer – The optimizer object to whose parameter refs the given
param_dictshould be reduced.
- Returns
A new ParamDict only containing param ref keys that belong to
optimizer.