Skip to main content

load_policy_from_broadcast

Function load_policy_from_broadcast 

Source
pub fn load_policy_from_broadcast<B2, M>(
    module: M,
    broadcast: &PolicyBroadcast,
    device: &B2::Device,
) -> Result<M>
where B2: Backend, M: Module<B2>,
Expand description

Deserialize a crate::multi_agent::PolicyBroadcast into module.

The inverse of serialize_policy: decodes the burn::record::BinBytesRecorder blob and loads it into the given module (consuming and returning it, per Burn’s move-through record API). Backend-agnostic — the blob may have been produced on a different backend with matching element types.

§Errors

Returns an error when the byte blob fails to decode as M’s record.