Skip to main content

load_agent

Function load_agent 

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

Loads an agent from a JSON save file (CPU backend).

Reads the file, deserializes the SaveFile, validates that the topology matches the config, then reconstructs the agent using CpuLinAlg (the default backend).

§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.