pub struct Graph { /* private fields */ }Expand description
The computation graph arena.
Implementations§
Source§impl Graph
impl Graph
pub fn new() -> Self
Sourcepub fn add_node(
&mut self,
op: OpKind,
inputs: SmallVec<[NodeId; 2]>,
meta: TensorMeta,
) -> NodeId
pub fn add_node( &mut self, op: OpKind, inputs: SmallVec<[NodeId; 2]>, meta: TensorMeta, ) -> NodeId
Add a node and return its ID.
Sourcepub fn add_node_raw(
&mut self,
op: OpKind,
inputs: SmallVec<[NodeId; 2]>,
meta: TensorMeta,
) -> NodeId
pub fn add_node_raw( &mut self, op: OpKind, inputs: SmallVec<[NodeId; 2]>, meta: TensorMeta, ) -> NodeId
Add a node without CSE.
Sourcepub fn intern_node(
&mut self,
op: OpKind,
inputs: SmallVec<[NodeId; 2]>,
meta: TensorMeta,
const_payload: Option<&[f32]>,
) -> NodeId
pub fn intern_node( &mut self, op: OpKind, inputs: SmallVec<[NodeId; 2]>, meta: TensorMeta, const_payload: Option<&[f32]>, ) -> NodeId
Add a node with CSE. For constants, include a payload hash if available.
pub fn const_payload(&self, id: NodeId) -> Option<&[f32]>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Graph
impl RefUnwindSafe for Graph
impl Send for Graph
impl Sync for Graph
impl Unpin for Graph
impl UnsafeUnpin for Graph
impl UnwindSafe for Graph
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