ray.rllib.policy.eager_tf_policy_v2.EagerTFPolicyV2.apply_gradients_fn#

EagerTFPolicyV2.apply_gradients_fn(optimizer: tf.keras.optimizers.Optimizer, grads: List[Tuple[numpy.array | jnp.ndarray | tf.Tensor | torch.Tensor, numpy.array | jnp.ndarray | tf.Tensor | torch.Tensor]] | List[numpy.array | jnp.ndarray | tf.Tensor | torch.Tensor]) tf.Operation[source]#

Gradients computing function (from loss tensor, using local optimizer).

Parameters:
  • optimizer – The tf (local) optimizer object to calculate the gradients with.

  • grads – The gradient tensor to be applied.

Returns:

TF operation that applies supplied gradients.

Return type:

“tf.Operation”