pub struct GraphBuilder { /* private fields */ }Expand description
Graph builder for convenient graph construction.
Implementations§
Source§impl GraphBuilder
impl GraphBuilder
Sourcepub fn add_op(&mut self, op_type: &str, name: Option<String>) -> NodeId
pub fn add_op(&mut self, op_type: &str, name: Option<String>) -> NodeId
Add a node with the given operation type.
Sourcepub fn add_input(&mut self, node_id: NodeId, tensor_name: &str) -> &mut Self
pub fn add_input(&mut self, node_id: NodeId, tensor_name: &str) -> &mut Self
Add an input tensor to a node.
Sourcepub fn add_output(&mut self, node_id: NodeId, tensor_name: &str) -> &mut Self
pub fn add_output(&mut self, node_id: NodeId, tensor_name: &str) -> &mut Self
Add an output tensor to a node.
Sourcepub fn add_attribute(
&mut self,
node_id: NodeId,
name: &str,
value: AttributeValue,
) -> &mut Self
pub fn add_attribute( &mut self, node_id: NodeId, name: &str, value: AttributeValue, ) -> &mut Self
Add an attribute to a node.
Sourcepub fn connect(
&mut self,
from_node: NodeId,
to_node: NodeId,
tensor_name: &str,
) -> Result<&mut Self>
pub fn connect( &mut self, from_node: NodeId, to_node: NodeId, tensor_name: &str, ) -> Result<&mut Self>
Connect two nodes with a tensor.
Sourcepub fn set_inputs(&mut self, inputs: Vec<String>) -> &mut Self
pub fn set_inputs(&mut self, inputs: Vec<String>) -> &mut Self
Set graph inputs.
Sourcepub fn set_outputs(&mut self, outputs: Vec<String>) -> &mut Self
pub fn set_outputs(&mut self, outputs: Vec<String>) -> &mut Self
Set graph outputs.
Sourcepub fn build(self) -> Result<ModelGraph>
pub fn build(self) -> Result<ModelGraph>
Build the final graph.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GraphBuilder
impl RefUnwindSafe for GraphBuilder
impl Send for GraphBuilder
impl Sync for GraphBuilder
impl Unpin for GraphBuilder
impl UnwindSafe for GraphBuilder
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more