ray.rllib.policy.torch_policy_v2.TorchPolicyV2.from_state#
- static TorchPolicyV2.from_state(state: Dict[str, numpy.array | jnp.ndarray | tf.Tensor | torch.Tensor | dict | tuple]) Policy #
Recovers a Policy from a state object.
The
state
of an instantiated Policy can be retrieved by calling itsget_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.