pub struct GraphSession { /* private fields */ }Expand description
The primary orchestrator: Graph + filters + cache + events.
ⓘ
let mut lib = FilterLibrary::new();
lib.register("scaler", Box::new(MyScaler::new()));
lib.register("model", Box::new(MyModel::new()));
let mut session = GraphSession::new(graph, lib);
session.fit(&train_x, Some(&train_y))?;
let output = session.forward(&test_x)?;Implementations§
Source§impl GraphSession
impl GraphSession
pub fn new(graph: Graph, library: FilterLibrary) -> Self
pub fn with_cache(self, cache: Arc<dyn CacheStore>) -> Self
pub fn with_event_bus(self, bus: Arc<EventBus>) -> Self
pub fn with_data_store(self, store: Arc<dyn DataStore>) -> Self
pub fn with_transport(self, transport: Arc<dyn Transport>) -> Self
Sourcepub fn compile(&self, mode: CompileMode) -> Result<CompileResult>
pub fn compile(&self, mode: CompileMode) -> Result<CompileResult>
Compile the graph and return diagnostics without executing.
Sourcepub fn run(&mut self, mode: CompileMode) -> Result<HashMap<String, Value>>
pub fn run(&mut self, mode: CompileMode) -> Result<HashMap<String, Value>>
Compile and execute the graph, returning all node outputs.
Sourcepub fn fit(
&mut self,
x: &Value,
y: Option<&Value>,
) -> Result<HashMap<String, Value>>
pub fn fit( &mut self, x: &Value, y: Option<&Value>, ) -> Result<HashMap<String, Value>>
Fit all trainable filters in topological order. Delegates to LocalRunner — same execution path as remote workers.
Sourcepub fn forward_with(
&self,
x: &Value,
strategy: &dyn ForwardStrategy,
) -> Result<Value>
pub fn forward_with( &self, x: &Value, strategy: &dyn ForwardStrategy, ) -> Result<Value>
Forward pass using the given strategy.
Strategies define HOW data flows through the compiled graph:
- [
Standard] — full input at once with inference caching (default) - [
Stream] — chunked input through StreamExecutor - [
Batched] — rows from DataStore, batch by batch
Sourcepub fn forward(&self, x: &Value) -> Result<Value>
pub fn forward(&self, x: &Value) -> Result<Value>
Standard forward pass (shortcut for forward_with(x, &Standard)).
Sourcepub fn persist_states(&self) -> Result<DataRef>
pub fn persist_states(&self) -> Result<DataRef>
Persist all trained states to the data store.
Sourcepub fn load_states(&mut self, data_ref: &DataRef) -> Result<()>
pub fn load_states(&mut self, data_ref: &DataRef) -> Result<()>
Load previously persisted states from a data store reference.
Sourcepub fn library(&self) -> &FilterLibrary
pub fn library(&self) -> &FilterLibrary
Access the filter library.
Sourcepub fn library_mut(&mut self) -> &mut FilterLibrary
pub fn library_mut(&mut self) -> &mut FilterLibrary
Mutable access to the filter library (for registering filters after creation).
Auto Trait Implementations§
impl Freeze for GraphSession
impl !RefUnwindSafe for GraphSession
impl Send for GraphSession
impl Sync for GraphSession
impl Unpin for GraphSession
impl UnsafeUnpin for GraphSession
impl !UnwindSafe for GraphSession
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more