Trait zyx_core::runtime::RuntimeBackend
source · 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
Object Safety§
This trait is not object safe.