pub struct GraphProgramLoweringView<'a> { /* private fields */ }Expand description
Read-only lowering view over a compiled graph program.
This view is for peer executor crates that need to translate a
GraphProgram without mutating the runtime-owned
execution program.
§Examples
use tenferro_runtime::{GraphCompiler, TracedTensor};
let x = TracedTensor::from_vec_col_major(vec![1], vec![2.0_f64]).unwrap();
let mut compiler = GraphCompiler::new();
let program = compiler.compile(&x.neg()).unwrap();
let view = program.lowering_view();
assert_eq!(view.output_slots().len(), 1);Implementations§
Source§impl<'a> GraphProgramLoweringView<'a>
impl<'a> GraphProgramLoweringView<'a>
Sourcepub fn slot_count(&self) -> usize
pub fn slot_count(&self) -> usize
Return the number of execution slots used by the program.
§Examples
use tenferro_runtime::{GraphCompiler, TracedTensor};
let x = TracedTensor::from_vec_col_major(vec![1], vec![2.0_f64]).unwrap();
let mut compiler = GraphCompiler::new();
let program = compiler.compile(&x.neg()).unwrap();
assert!(program.lowering_view().slot_count() >= 1);Sourcepub fn input_slots(&self) -> &'a [usize]
pub fn input_slots(&self) -> &'a [usize]
Return the execution slots populated by graph inputs.
§Examples
use tenferro_runtime::{GraphCompiler, TracedTensor};
let x = TracedTensor::from_vec_col_major(vec![1], vec![2.0_f64]).unwrap();
let mut compiler = GraphCompiler::new();
let program = compiler.compile(&x.neg()).unwrap();
assert_eq!(program.lowering_view().input_slots().len(), 1);Sourcepub fn output_slots(&self) -> &'a [usize]
pub fn output_slots(&self) -> &'a [usize]
Return the execution slots used as program outputs.
§Examples
use tenferro_runtime::{GraphCompiler, TracedTensor};
let x = TracedTensor::from_vec_col_major(vec![1], vec![2.0_f64]).unwrap();
let mut compiler = GraphCompiler::new();
let program = compiler.compile(&x.neg()).unwrap();
assert_eq!(program.lowering_view().output_slots().len(), 1);Sourcepub fn instructions(
&self,
) -> impl ExactSizeIterator<Item = GraphInstructionView<'a>> + '_
pub fn instructions( &self, ) -> impl ExactSizeIterator<Item = GraphInstructionView<'a>> + '_
Iterate over read-only instruction views in execution order.
§Examples
use tenferro_runtime::{GraphCompiler, TracedTensor};
let x = TracedTensor::from_vec_col_major(vec![1], vec![2.0_f64]).unwrap();
let mut compiler = GraphCompiler::new();
let program = compiler.compile(&x.neg()).unwrap();
assert!(program.lowering_view().instructions().count() >= 1);Trait Implementations§
Source§impl<'a> Clone for GraphProgramLoweringView<'a>
impl<'a> Clone for GraphProgramLoweringView<'a>
Source§fn clone(&self) -> GraphProgramLoweringView<'a>
fn clone(&self) -> GraphProgramLoweringView<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for GraphProgramLoweringView<'_>
impl Debug for GraphProgramLoweringView<'_>
impl<'a> Copy for GraphProgramLoweringView<'a>
Auto Trait Implementations§
impl<'a> Freeze for GraphProgramLoweringView<'a>
impl<'a> !RefUnwindSafe for GraphProgramLoweringView<'a>
impl<'a> Send for GraphProgramLoweringView<'a>
impl<'a> Sync for GraphProgramLoweringView<'a>
impl<'a> Unpin for GraphProgramLoweringView<'a>
impl<'a> UnsafeUnpin for GraphProgramLoweringView<'a>
impl<'a> !UnwindSafe for GraphProgramLoweringView<'a>
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