ray.rllib.policy.Policy.from_state#

static Policy.from_state(state: Dict[str, numpy.array | jnp.ndarray | tf.Tensor | torch.Tensor | dict | tuple]) Policy[source]#

Recovers a Policy from a state object.

The state of an instantiated Policy can be retrieved by calling its get_state method. This only works for the V2 Policy classes (EagerTFPolicyV2, SynamicTFPolicyV2, and TorchPolicyV2). It contains all information necessary to create the Policy. No access to the original code (e.g. configs, knowledge of the policy’s class, etc..) is needed.

Parameters:

state – The state to recover a new Policy instance from.

Returns:

A new Policy instance.