ray.rllib.utils.torch_utils.minimize_and_clip#

ray.rllib.utils.torch_utils.minimize_and_clip(optimizer: torch.optim.Optimizer, clip_val: float = 10.0) None[source]#

Clips grads found in optimizer.param_groups to given value in place.

Ensures the norm of the gradients for each variable is clipped to clip_val.

Parameters:
  • optimizer – The torch.optim.Optimizer to get the variables from.

  • clip_val – The global norm clip value. Will clip around -clip_val and +clip_val.