Skip to main content

load_agent_generic

Function load_agent_generic 

Source
pub fn load_agent_generic<L: LinAlg>(
    path: &str,
) -> Result<(PcActorCritic<L>, AgentMetadata), PcError>
Expand description

Loads an agent from a JSON save file with a specific LinAlg backend.

Same as load_agent but reconstructs the agent using the specified backend type L. Weights are deserialized as CPU types and then converted via PcActor::<L>::from_weights() and MlpCritic::<L>::from_weights().

§Arguments

  • path - Path to the JSON save file.

§Errors

Returns PcError::Io if the file doesn’t exist, PcError::Serialization for invalid JSON, or PcError::DimensionMismatch if the saved weights don’t match the config topology.