pub struct Graph<'a> {
pub name: &'a str,
pub tensors: &'a [Tensor<'a>],
pub shapes: &'a [Shape<'a>],
pub operators: &'a [Operator<'a>],
pub inputs: &'a [&'a str],
pub outputs: &'a [&'a str],
}Expand description
A static TOSA graph containing one region and one basic block.
Fields§
§name: &'a str§tensors: &'a [Tensor<'a>]§shapes: &'a [Shape<'a>]§operators: &'a [Operator<'a>]§inputs: &'a [&'a str]§outputs: &'a [&'a str]Implementations§
Source§impl<'a> Graph<'a>
impl<'a> Graph<'a>
pub const fn new( name: &'a str, tensors: &'a [Tensor<'a>], operators: &'a [Operator<'a>], inputs: &'a [&'a str], outputs: &'a [&'a str], ) -> Self
Sourcepub const fn with_shapes(self, shapes: &'a [Shape<'a>]) -> Self
pub const fn with_shapes(self, shapes: &'a [Shape<'a>]) -> Self
Add compile-time shape values to this graph.
Sourcepub fn build(self, target: Target) -> Result<Vec<u8>, BuildError>
pub fn build(self, target: Target) -> Result<Vec<u8>, BuildError>
Serialize and semantically validate this graph for target.
The returned vector is the only allocation retained by the caller.
Construction is linear in graph metadata and constant bytes. Validation
runs once on this cold authoring path; providers still perform their own
authoritative admission during load_program.
Trait Implementations§
impl<'a> Copy for Graph<'a>
impl<'a> Eq for Graph<'a>
Source§impl<'a> From<Graph<'a>> for OwnedGraph<'a>
impl<'a> From<Graph<'a>> for OwnedGraph<'a>
impl<'a> StructuralPartialEq for Graph<'a>
Auto Trait Implementations§
impl<'a> Freeze for Graph<'a>
impl<'a> RefUnwindSafe for Graph<'a>
impl<'a> Send for Graph<'a>
impl<'a> Sync for Graph<'a>
impl<'a> Unpin for Graph<'a>
impl<'a> UnsafeUnpin for Graph<'a>
impl<'a> UnwindSafe for Graph<'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