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§
Sourcefn execute(
&self,
plan: &ExecutionPlan,
filters: &FilterLibrary,
input: &Value,
y: Option<&Value>,
fit_mode: bool,
) -> Result<(Value, HashMap<String, Value>)>
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.
Sourcefn get_state(&self, node_ids: &[String]) -> Result<HashMap<String, Value>>
fn get_state(&self, node_ids: &[String]) -> Result<HashMap<String, Value>>
Request trained states from the remote worker.
Sourcefn set_state(&self, states: &HashMap<String, Value>) -> Result<()>
fn set_state(&self, states: &HashMap<String, Value>) -> Result<()>
Load states on the remote worker.