pub struct Runtime<R: RuntimeBackend> { /* private fields */ }
Expand description
Runtime with autograd engine. This runtime uses Node enum as representation of tensors.
Implementations§
source§impl<R: RuntimeBackend> Runtime<R>
impl<R: RuntimeBackend> Runtime<R>
sourcepub fn randn(&mut self, shape: Shape, dtype: DType) -> Result<Id, ZyxError>
pub fn randn(&mut self, shape: Shape, dtype: DType) -> Result<Id, ZyxError>
Create tensor initialized from normal distribution.
sourcepub fn uniform<T: Scalar>(
&mut self,
shape: Shape,
range: Range<T>
) -> Result<Id, ZyxError>
pub fn uniform<T: Scalar>( &mut self, shape: Shape, range: Range<T> ) -> Result<Id, ZyxError>
Create uniform tensor from range low..high
sourcepub fn store<T: Scalar, IT>(&mut self, iter: IT) -> Result<Id, ZyxError>
pub fn store<T: Scalar, IT>(&mut self, iter: IT) -> Result<Id, ZyxError>
Store iterator into runtime as tensor
sourcepub fn push(&mut self, node: Node) -> Result<Id, ZyxError>
pub fn push(&mut self, node: Node) -> Result<Id, ZyxError>
Push new Node into the graph creating new tensor. This function does ZERO verification that the node is correct, but it optimizes out useless operations (like reshaping to the same shape)
sourcepub fn release(&mut self, x: Id) -> Result<(), ZyxError>
pub fn release(&mut self, x: Id) -> Result<(), ZyxError>
Decrease reference count of x. If x’s reference count reaches zero, this function will delete x and release all of it’s predecessors in the graph.
sourcepub fn debug_graph(&self)
pub fn debug_graph(&self)
Debug print all nodes
sourcepub fn evaluate(&mut self, nodes: BTreeSet<Id>) -> Result<(), ZyxError>
pub fn evaluate(&mut self, nodes: BTreeSet<Id>) -> Result<(), ZyxError>
Evaluate specified nodes.
sourcepub fn plot_graph_dot(&self, ids: &[Id]) -> String
pub fn plot_graph_dot(&self, ids: &[Id]) -> String
Plot dot graph in dot format between given nodes
Auto Trait Implementations§
impl<R> Freeze for Runtime<R>where
R: Freeze,
impl<R> RefUnwindSafe for Runtime<R>where
R: RefUnwindSafe,
impl<R> Send for Runtime<R>where
R: Send,
impl<R> Sync for Runtime<R>where
R: Sync,
impl<R> Unpin for Runtime<R>where
R: Unpin,
impl<R> UnwindSafe for Runtime<R>where
R: UnwindSafe,
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