ray.rllib.policy.torch_policy_v2.TorchPolicyV2.apply#

TorchPolicyV2.apply(func: Callable[[Policy, Any | None, Any | None], T], *args, **kwargs) T#

Calls the given function with this Policy instance.

Useful for when the Policy class has been converted into a ActorHandle and the user needs to execute some functionality (e.g. add a property) on the underlying policy object.

Parameters:
  • func – The function to call, with this Policy as first argument, followed by args, and kwargs.

  • args – Optional additional args to pass to the function call.

  • kwargs – Optional additional kwargs to pass to the function call.

Returns:

The return value of the function call.