Skip to main content

gigastt_core/runtime/
session.rs

1use super::{error::RuntimeError, tensor::Tensor};
2
3/// One loaded model session: encoder, decoder, or joiner.
4pub trait RuntimeSession: Send + Sync + 'static {
5    fn run(&self, inputs: &[Tensor]) -> Result<Vec<Tensor>, RuntimeError>;
6
7    /// Low-latency encoder path used by streaming windows.
8    ///
9    /// Default delegates to [`Self::run`]. The ANE encoder overrides this to
10    /// accept a lower pad fill floor so short streaming windows can pad into the
11    /// smallest eligible bucket instead of falling back to ort.
12    fn run_low_latency(&self, inputs: &[Tensor]) -> Result<Vec<Tensor>, RuntimeError> {
13        self.run(inputs)
14    }
15
16    /// True when this encoder runs on the ANE fixed-shape pad-up path.
17    ///
18    /// Used to pick a longer long-form chunk window (30s fills ANE bucket 3000
19    /// nearly full; ort keeps 24s for peak activation memory). Default false.
20    fn is_ane_encoder(&self) -> bool {
21        false
22    }
23}