pub fn load_model<M: Module, P: AsRef<Path>>(
model: &M,
path: P,
) -> Result<usize>Expand description
Load a model’s parameters from a saved state dictionary file.
Matches parameters by name. Returns the number of parameters loaded. Parameters not found in the state dict are left unchanged.
§Example
ⓘ
let mut model = MyModel::new();
let loaded = load_model(&model, "model.axonml")?;
println!("Loaded {loaded} parameters");