Skip to main content

spawn_actor

Function spawn_actor 

Source
pub fn spawn_actor<B2, M, E, F>(
    actor_id: AgentId,
    env: E,
    policy: M,
    experience_tx: Sender<Experience>,
    device: B2::Device,
    seed: u64,
    throttle: ActorThrottle,
    act_fn: F,
) -> ActorHandle
where B2: Backend, B2::Device: Send + 'static, M: Module<B2> + Send + 'static, E: Environment<Action = i64> + Send + 'static, F: FnMut(&M, &[f32], &mut StdRng) -> (i64, f32, f32) + Send + 'static,
Expand description

Spawn one actor thread and return its ActorHandle.

Creates the per-actor broadcast and control channels internally; the caller supplies a clone of the shared actors→learner experience sender. See actor_thread for the loop semantics and the act_fn contract.