pub trait RuntimeBackend {
// Required methods
fn is_evaluated(&self, x: Id) -> bool;
fn is_free_id(&self, x: Id) -> bool;
fn remove(&mut self, x: Id) -> Result<(), ZyxError>;
fn store<T: Scalar, IT>(&mut self, x: Id, iter: IT) -> Result<(), ZyxError>
where IT: IntoIterator<Item = T>,
IT::IntoIter: ExactSizeIterator;
fn load<T: Scalar>(
&mut self,
x: Id,
numel: usize,
) -> Result<Vec<T>, ZyxError>;
fn evaluate(
&mut self,
rcs: BTreeMap<Id, u32>,
order: &[Id],
nodes: &[Node],
) -> Result<(), ZyxError>;
}
Expand description
RuntimeBackend is a good plug in point for backend developers. Use Runtime::new(YourOwnStructThatImplementsRuntimeBackend::new()) to write your own backend which needs to implement only evaluation of graph. Used by torch and native backends.
Required Methods§
Sourcefn is_evaluated(&self, x: Id) -> bool
fn is_evaluated(&self, x: Id) -> bool
Is tensor x evaluated?
Sourcefn is_free_id(&self, x: Id) -> bool
fn is_free_id(&self, x: Id) -> bool
Check if there are no more buffers on id x
Sourcefn store<T: Scalar, IT>(&mut self, x: Id, iter: IT) -> Result<(), ZyxError>
fn store<T: Scalar, IT>(&mut self, x: Id, iter: IT) -> Result<(), ZyxError>
Store iterator into runtime backend
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.