Skip to main content

Transport

Trait Transport 

Source
pub trait Transport: Send + Sync {
    // Required methods
    fn execute(
        &self,
        plan: &ExecutionPlan,
        filters: &FilterLibrary,
        input: &Value,
        y: Option<&Value>,
        fit_mode: bool,
    ) -> Result<(Value, HashMap<String, Value>)>;
    fn get_state(&self, node_ids: &[String]) -> Result<HashMap<String, Value>>;
    fn set_state(&self, states: &HashMap<String, Value>) -> Result<()>;
    fn get_gradients(
        &self,
        node_ids: &[String],
    ) -> Result<HashMap<String, Value>>;
    fn apply_gradients(&self, gradients: &HashMap<String, Value>) -> Result<()>;

    // Provided method
    fn execute_node(
        &self,
        node_id: &str,
        input: Option<&Value>,
    ) -> Result<Value> { ... }
}
Expand description

Abstraction for communicating with remote workers. Implemented by WsTransport (WebSocket), but could be HTTP, gRPC, etc.

Required Methods§

Source

fn execute( &self, plan: &ExecutionPlan, filters: &FilterLibrary, input: &Value, y: Option<&Value>, fit_mode: bool, ) -> Result<(Value, HashMap<String, Value>)>

Send a plan for execution and receive the output + trained states.

Source

fn get_state(&self, node_ids: &[String]) -> Result<HashMap<String, Value>>

Request trained states from the remote worker.

Source

fn set_state(&self, states: &HashMap<String, Value>) -> Result<()>

Load states on the remote worker.

Source

fn get_gradients(&self, node_ids: &[String]) -> Result<HashMap<String, Value>>

Request gradients from the remote worker.

Source

fn apply_gradients(&self, gradients: &HashMap<String, Value>) -> Result<()>

Apply aggregated gradients on the remote worker.

Provided Methods§

Source

fn execute_node(&self, node_id: &str, input: Option<&Value>) -> Result<Value>

Convenience: execute a single node remotely (used by the plan executor).

Implementors§