pub struct GraphScope { /* private fields */ }Expand description
Owns a traced graph while you build symbolic tensors.
Implementations§
Source§impl GraphScope
impl GraphScope
pub fn new(name: impl Into<String>) -> Self
pub fn graph(&self) -> Graph
Sourcepub fn fresh_symbol(&mut self) -> u32
pub fn fresh_symbol(&mut self) -> u32
Fresh dynamic-dimension symbol (for variable batch / sequence length).
pub fn input( &mut self, name: impl Into<String>, shape: impl Into<Shape>, ) -> Tensor
Sourcepub fn input_dyn(
&mut self,
name: impl Into<String>,
dims: &[Dim],
dtype: DType,
) -> Tensor
pub fn input_dyn( &mut self, name: impl Into<String>, dims: &[Dim], dtype: DType, ) -> Tensor
Input with a caller-chosen dynamic symbol on one axis.
pub fn param( &mut self, name: impl Into<String>, shape: impl Into<Shape>, ) -> Tensor
pub fn constant(&mut self, value: f64, dtype: DType) -> Tensor
Sourcepub fn cat(&mut self, tensors: &[&Tensor], axis: usize) -> Tensor
pub fn cat(&mut self, tensors: &[&Tensor], axis: usize) -> Tensor
Stack existing tensors along axis (zero-copy at IR level).
pub fn set_outputs( &mut self, outputs: impl IntoIterator<Item = impl Into<NodeId>>, )
pub fn finish(self) -> Graph
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for GraphScope
impl !Send for GraphScope
impl !Sync for GraphScope
impl !UnwindSafe for GraphScope
impl Freeze for GraphScope
impl Unpin for GraphScope
impl UnsafeUnpin for GraphScope
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