Struct wasi_nn::GraphBuilder
source · pub struct GraphBuilder { /* private fields */ }
Expand description
A graph factory for configuring the properties of a new graph.
Methods can be chained on it in order to configure it.
- Default Graph Encoding:
Openvino
. - Default Execution Target:
CPU
.
Examples
Build a graph with default config ( CPU
+ Openvino
)
let xml = "./mobilenet.xml";
let weight = "./mobilenet.bin";
let graph = GraphBuilder::default().build_from_files([xml, weight]).unwrap();
Build a graph with onnx backend and gpu device target
let graph = GraphBuilder::new(GraphEncoding::Onnx, ExecutionTarget::GPU)
.build_from_files(["./test.onnx"]).unwrap();
Implementations§
source§impl GraphBuilder
impl GraphBuilder
sourcepub fn new(encoding: GraphEncoding, target: ExecutionTarget) -> Self
pub fn new(encoding: GraphEncoding, target: ExecutionTarget) -> Self
Create a new GraphBuilder
.
sourcepub fn encoding(self, encoding: GraphEncoding) -> Self
pub fn encoding(self, encoding: GraphEncoding) -> Self
Set graph encoding.
sourcepub fn execution_target(self, execution_target: ExecutionTarget) -> Self
pub fn execution_target(self, execution_target: ExecutionTarget) -> Self
Set graph execution target.
pub fn build_from_bytes<B>( self, bytes_array: impl AsRef<[B]> ) -> Result<Graph, Error>where B: AsRef<[u8]>,
pub fn build_from_files<P>(self, files: impl AsRef<[P]>) -> Result<Graph, Error>where P: AsRef<Path>,
pub fn build_from_cache(self, name: &str) -> Result<Graph, Error>
Trait Implementations§
source§impl Clone for GraphBuilder
impl Clone for GraphBuilder
source§fn clone(&self) -> GraphBuilder
fn clone(&self) -> GraphBuilder
Returns a copy 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 GraphBuilder
impl Debug for GraphBuilder
Auto Trait Implementations§
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