pub struct GraphProgram { /* private fields */ }Expand description
A compiled traced graph, independent of any execution backend.
§Examples
use tenferro_runtime::{GraphCompiler, TracedTensor};
let x = TracedTensor::from_vec_col_major(vec![2], vec![1.0_f64, 2.0]).unwrap();
let y = (&x + &x).unwrap();
let mut compiler = GraphCompiler::new();
let program = compiler.compile(&y).unwrap();
assert_eq!(program.input_count(), 1);Implementations§
Source§impl GraphProgram
impl GraphProgram
Sourcepub fn input_count(&self) -> usize
pub fn input_count(&self) -> usize
Return the number of graph inputs expected by this program.
§Examples
use tenferro_runtime::{GraphCompiler, TracedTensor};
let x = TracedTensor::from_vec_col_major(vec![1], vec![3.0_f64]).unwrap();
let mut compiler = GraphCompiler::new();
let program = compiler.compile(&x.neg()).unwrap();
assert_eq!(program.input_count(), 1);Sourcepub fn output_count(&self) -> usize
pub fn output_count(&self) -> usize
Return the number of graph outputs produced by this program.
§Examples
use tenferro_runtime::{GraphCompiler, TracedTensor};
let x = TracedTensor::from_vec_col_major(vec![1], vec![3.0_f64]).unwrap();
let mut compiler = GraphCompiler::new();
let program = compiler.compile(&x.neg()).unwrap();
assert_eq!(program.output_count(), 1);Sourcepub fn input_specs(&self) -> &[GraphProgramInput]
pub fn input_specs(&self) -> &[GraphProgramInput]
Return the ordered input specs expected by this program.
§Examples
use tenferro_runtime::{DType, GraphCompiler, TracedTensor};
let x = TracedTensor::input_symbolic_shape(DType::F64, 1).unwrap();
let mut compiler = GraphCompiler::new();
let program = compiler
.compile_with_input_specs(&x.neg(), &[(&x, DType::F64, &[4])])
.unwrap();
assert_eq!(program.input_specs()[0].shape(), &[4]);Sourcepub fn lowering_view(&self) -> GraphProgramLoweringView<'_>
pub fn lowering_view(&self) -> GraphProgramLoweringView<'_>
Return a read-only lowering view for peer executor integrations.
The view exposes only immutable, lowering-oriented program metadata.
Native execution and mutation remain owned by GraphExecutor.
§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);Trait Implementations§
Source§impl Clone for GraphProgram
impl Clone for GraphProgram
Source§fn clone(&self) -> GraphProgram
fn clone(&self) -> GraphProgram
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 moreAuto Trait Implementations§
impl Freeze for GraphProgram
impl !RefUnwindSafe for GraphProgram
impl Send for GraphProgram
impl Sync for GraphProgram
impl Unpin for GraphProgram
impl UnsafeUnpin for GraphProgram
impl !UnwindSafe for GraphProgram
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