pub struct Engine {Show 13 fields
pub file: String,
pub spec: String,
pub device: Device,
pub iiixs: Vec<Iiix>,
pub params: Option<usize>,
pub wbmems: Option<usize>,
pub inputs_minoptmax: Vec<Vec<MinOptMax>>,
pub onnx: Option<OnnxIo>,
pub num_dry_run: usize,
pub graph_opt_level: Option<u8>,
pub num_intra_threads: Option<usize>,
pub num_inter_threads: Option<usize>,
pub hardware: HardwareConfig,
}Expand description
ONNX Runtime inference engine with configuration and session management.
Fields§
§file: StringModel file path.
spec: StringModel specification string.
device: DeviceExecution device.
iiixs: Vec<Iiix>§params: Option<usize>§wbmems: Option<usize>§inputs_minoptmax: Vec<Vec<MinOptMax>>Input min-opt-max configurations.
onnx: Option<OnnxIo>ONNX I/O structure.
num_dry_run: usizeNumber of dry runs for warmup.
graph_opt_level: Option<u8>§num_intra_threads: Option<usize>§num_inter_threads: Option<usize>§hardware: HardwareConfigHardware-specific configurations for all execution providers
Implementations§
Source§impl Engine
impl Engine
Sourcepub fn into_file(self) -> String
pub fn into_file(self) -> String
Consumes self and returns the file field.
This method moves the owned value out of the struct without cloning.
§Returns
Returns the owned value of type String.
§Example
let obj = Engine::default().with_file(value);
let value = obj.into_file();
// obj is now consumed and cannot be usedGenerated by aksr - Builder pattern macro
Sourcepub fn take_file(&mut self) -> String
pub fn take_file(&mut self) -> String
Takes the file field and replaces it with Default::default().
This method moves the value out and replaces it with the default value, allowing you to continue using the struct.
§Returns
Returns the owned value of type String.
§Note
Requires the field type String to implement Default. Prefer this when you want to keep using the instance.
§Example
let mut obj = Engine::default().with_file(value);
let value = obj.take_file();
// obj.file is now set to Default::default()Generated by aksr - Builder pattern macro
Sourcepub fn into_spec(self) -> String
pub fn into_spec(self) -> String
Consumes self and returns the spec field.
This method moves the owned value out of the struct without cloning.
§Returns
Returns the owned value of type String.
§Example
let obj = Engine::default().with_spec(value);
let value = obj.into_spec();
// obj is now consumed and cannot be usedGenerated by aksr - Builder pattern macro
Sourcepub fn take_spec(&mut self) -> String
pub fn take_spec(&mut self) -> String
Takes the spec field and replaces it with Default::default().
This method moves the value out and replaces it with the default value, allowing you to continue using the struct.
§Returns
Returns the owned value of type String.
§Note
Requires the field type String to implement Default. Prefer this when you want to keep using the instance.
§Example
let mut obj = Engine::default().with_spec(value);
let value = obj.take_spec();
// obj.spec is now set to Default::default()Generated by aksr - Builder pattern macro
Sourcepub fn with_device(self, x: Device) -> Self
pub fn with_device(self, x: Device) -> Self
Sourcepub fn into_device(self) -> Device
pub fn into_device(self) -> Device
Consumes self and returns the device field.
This method moves the owned value out of the struct without cloning.
§Returns
Returns the owned value of type Device.
§Example
let obj = Engine::default().with_device(value);
let value = obj.into_device();
// obj is now consumed and cannot be usedGenerated by aksr - Builder pattern macro
Sourcepub fn with_iiixs(self, x: &[Iiix]) -> Self
pub fn with_iiixs(self, x: &[Iiix]) -> Self
Sets the iiixs field from a slice.
§Arguments
x- A slice of elements to be converted into a vector
§Returns
Returns Self for method chaining.
§Note
If the slice is empty, the field remains unchanged.
§Example
let obj = Engine::default().with_iiixs(&[item1, item2]);Generated by aksr - Builder pattern macro
Sourcepub fn with_iiixs_extend(self, x: &[Iiix]) -> Self
pub fn with_iiixs_extend(self, x: &[Iiix]) -> Self
Sourcepub fn into_iiixs(self) -> Vec<Iiix>
pub fn into_iiixs(self) -> Vec<Iiix>
Consumes self and returns the iiixs field.
This method moves the owned value out of the struct without cloning.
§Returns
Returns the owned value of type Vec < Iiix >.
§Example
let obj = Engine::default().with_iiixs(value);
let value = obj.into_iiixs();
// obj is now consumed and cannot be usedGenerated by aksr - Builder pattern macro
Sourcepub fn take_iiixs(&mut self) -> Vec<Iiix>
pub fn take_iiixs(&mut self) -> Vec<Iiix>
Takes the iiixs field and replaces it with Default::default().
This method moves the value out and replaces it with the default value, allowing you to continue using the struct.
§Returns
Returns the owned value of type Vec < Iiix >.
§Note
Requires the field type Vec < Iiix > to implement Default. Prefer this when you want to keep using the instance.
§Example
let mut obj = Engine::default().with_iiixs(value);
let value = obj.take_iiixs();
// obj.iiixs is now set to Default::default()Generated by aksr - Builder pattern macro
Sourcepub fn with_parameters(self, x: usize) -> Self
pub fn with_parameters(self, x: usize) -> Self
Sets the optional params field.
§Arguments
x- The value that will be automatically wrapped inSome
§Returns
Returns Self for method chaining.
§Note
The value is automatically wrapped in Some, so you don’t need to pass Some(value).
§Example
let obj = Engine::default().with_parameters(value);Generated by aksr - Builder pattern macro
Sourcepub fn parameters(&self) -> Option<usize>
pub fn parameters(&self) -> Option<usize>
Sourcepub fn into_parameters(self) -> Option<usize>
pub fn into_parameters(self) -> Option<usize>
Consumes self and returns the params field.
This method moves the owned value out of the struct without cloning.
§Returns
Returns Option
§Example
let obj = Engine::default().with_parameters(value);
let value = obj.into_parameters();Generated by aksr - Builder pattern macro
Sourcepub fn take_parameters(&mut self) -> Option<usize>
pub fn take_parameters(&mut self) -> Option<usize>
Takes the params field, leaving None in its place.
This method moves the value out and replaces it with None, allowing you to continue using the struct.
§Returns
Returns Option
§Note
This does not require the inner type to implement Default.
§Example
let mut obj = Engine::default().with_parameters(value);
let value = obj.take_parameters();
// obj.params is now NoneGenerated by aksr - Builder pattern macro
Sourcepub fn with_memory(self, x: usize) -> Self
pub fn with_memory(self, x: usize) -> Self
Sets the optional wbmems field.
§Arguments
x- The value that will be automatically wrapped inSome
§Returns
Returns Self for method chaining.
§Note
The value is automatically wrapped in Some, so you don’t need to pass Some(value).
§Example
let obj = Engine::default().with_memory(value);Generated by aksr - Builder pattern macro
Sourcepub fn into_memory(self) -> Option<usize>
pub fn into_memory(self) -> Option<usize>
Consumes self and returns the wbmems field.
This method moves the owned value out of the struct without cloning.
§Returns
Returns Option
§Example
let obj = Engine::default().with_memory(value);
let value = obj.into_memory();Generated by aksr - Builder pattern macro
Sourcepub fn take_memory(&mut self) -> Option<usize>
pub fn take_memory(&mut self) -> Option<usize>
Takes the wbmems field, leaving None in its place.
This method moves the value out and replaces it with None, allowing you to continue using the struct.
§Returns
Returns Option
§Note
This does not require the inner type to implement Default.
§Example
let mut obj = Engine::default().with_memory(value);
let value = obj.take_memory();
// obj.wbmems is now NoneGenerated by aksr - Builder pattern macro
Sourcepub fn with_inputs_minoptmax(self, x: &[Vec<MinOptMax>]) -> Self
pub fn with_inputs_minoptmax(self, x: &[Vec<MinOptMax>]) -> Self
Sets the inputs_minoptmax field from a slice.
§Arguments
x- A slice of elements to be converted into a vector
§Returns
Returns Self for method chaining.
§Note
If the slice is empty, the field remains unchanged.
§Example
let obj = Engine::default().with_inputs_minoptmax(&[item1, item2]);Generated by aksr - Builder pattern macro
Sourcepub fn inputs_minoptmax(&self) -> &[Vec<MinOptMax>]
pub fn inputs_minoptmax(&self) -> &[Vec<MinOptMax>]
Sourcepub fn into_inputs_minoptmax(self) -> Vec<Vec<MinOptMax>>
pub fn into_inputs_minoptmax(self) -> Vec<Vec<MinOptMax>>
Consumes self and returns the inputs_minoptmax field.
This method moves the owned value out of the struct without cloning.
§Returns
Returns the owned value of type Vec < Vec < MinOptMax > >.
§Example
let obj = Engine::default().with_inputs_minoptmax(value);
let value = obj.into_inputs_minoptmax();
// obj is now consumed and cannot be usedGenerated by aksr - Builder pattern macro
Sourcepub fn take_inputs_minoptmax(&mut self) -> Vec<Vec<MinOptMax>>
pub fn take_inputs_minoptmax(&mut self) -> Vec<Vec<MinOptMax>>
Takes the inputs_minoptmax field and replaces it with Default::default().
This method moves the value out and replaces it with the default value, allowing you to continue using the struct.
§Returns
Returns the owned value of type Vec < Vec < MinOptMax > >.
§Note
Requires the field type Vec < Vec < MinOptMax > > to implement Default. Prefer this when you want to keep using the instance.
§Example
let mut obj = Engine::default().with_inputs_minoptmax(value);
let value = obj.take_inputs_minoptmax();
// obj.inputs_minoptmax is now set to Default::default()Generated by aksr - Builder pattern macro
Sourcepub fn with_onnx(self, x: OnnxIo) -> Self
pub fn with_onnx(self, x: OnnxIo) -> Self
Sets the optional onnx field.
§Arguments
x- The value that will be automatically wrapped inSome
§Returns
Returns Self for method chaining.
§Note
The value is automatically wrapped in Some, so you don’t need to pass Some(value).
§Example
let obj = Engine::default().with_onnx(value);Generated by aksr - Builder pattern macro
Sourcepub fn into_onnx(self) -> Option<OnnxIo>
pub fn into_onnx(self) -> Option<OnnxIo>
Consumes self and returns the onnx field.
This method moves the owned value out of the struct without cloning.
§Returns
Returns Option
§Example
let obj = Engine::default().with_onnx(value);
let value = obj.into_onnx();Generated by aksr - Builder pattern macro
Sourcepub fn take_onnx(&mut self) -> Option<OnnxIo>
pub fn take_onnx(&mut self) -> Option<OnnxIo>
Takes the onnx field, leaving None in its place.
This method moves the value out and replaces it with None, allowing you to continue using the struct.
§Returns
Returns Option
§Note
This does not require the inner type to implement Default.
§Example
let mut obj = Engine::default().with_onnx(value);
let value = obj.take_onnx();
// obj.onnx is now NoneGenerated by aksr - Builder pattern macro
Sourcepub fn with_num_dry_run(self, x: usize) -> Self
pub fn with_num_dry_run(self, x: usize) -> Self
Sourcepub fn num_dry_run(&self) -> usize
pub fn num_dry_run(&self) -> usize
Sourcepub fn with_graph_opt_level(self, x: u8) -> Self
pub fn with_graph_opt_level(self, x: u8) -> Self
Sets the optional graph_opt_level field.
§Arguments
x- The value that will be automatically wrapped inSome
§Returns
Returns Self for method chaining.
§Note
The value is automatically wrapped in Some, so you don’t need to pass Some(value).
§Example
let obj = Engine::default().with_graph_opt_level(value);Generated by aksr - Builder pattern macro
Sourcepub fn graph_opt_level(&self) -> Option<u8>
pub fn graph_opt_level(&self) -> Option<u8>
Sourcepub fn into_graph_opt_level(self) -> Option<u8>
pub fn into_graph_opt_level(self) -> Option<u8>
Consumes self and returns the graph_opt_level field.
This method moves the owned value out of the struct without cloning.
§Returns
Returns Option
§Example
let obj = Engine::default().with_graph_opt_level(value);
let value = obj.into_graph_opt_level();Generated by aksr - Builder pattern macro
Sourcepub fn take_graph_opt_level(&mut self) -> Option<u8>
pub fn take_graph_opt_level(&mut self) -> Option<u8>
Takes the graph_opt_level field, leaving None in its place.
This method moves the value out and replaces it with None, allowing you to continue using the struct.
§Returns
Returns Option
§Note
This does not require the inner type to implement Default.
§Example
let mut obj = Engine::default().with_graph_opt_level(value);
let value = obj.take_graph_opt_level();
// obj.graph_opt_level is now NoneGenerated by aksr - Builder pattern macro
Sourcepub fn with_num_intra_threads(self, x: usize) -> Self
pub fn with_num_intra_threads(self, x: usize) -> Self
Sets the optional num_intra_threads field.
§Arguments
x- The value that will be automatically wrapped inSome
§Returns
Returns Self for method chaining.
§Note
The value is automatically wrapped in Some, so you don’t need to pass Some(value).
§Example
let obj = Engine::default().with_num_intra_threads(value);Generated by aksr - Builder pattern macro
Sourcepub fn num_intra_threads(&self) -> Option<usize>
pub fn num_intra_threads(&self) -> Option<usize>
Sourcepub fn into_num_intra_threads(self) -> Option<usize>
pub fn into_num_intra_threads(self) -> Option<usize>
Consumes self and returns the num_intra_threads field.
This method moves the owned value out of the struct without cloning.
§Returns
Returns Option
§Example
let obj = Engine::default().with_num_intra_threads(value);
let value = obj.into_num_intra_threads();Generated by aksr - Builder pattern macro
Sourcepub fn take_num_intra_threads(&mut self) -> Option<usize>
pub fn take_num_intra_threads(&mut self) -> Option<usize>
Takes the num_intra_threads field, leaving None in its place.
This method moves the value out and replaces it with None, allowing you to continue using the struct.
§Returns
Returns Option
§Note
This does not require the inner type to implement Default.
§Example
let mut obj = Engine::default().with_num_intra_threads(value);
let value = obj.take_num_intra_threads();
// obj.num_intra_threads is now NoneGenerated by aksr - Builder pattern macro
Sourcepub fn with_num_inter_threads(self, x: usize) -> Self
pub fn with_num_inter_threads(self, x: usize) -> Self
Sets the optional num_inter_threads field.
§Arguments
x- The value that will be automatically wrapped inSome
§Returns
Returns Self for method chaining.
§Note
The value is automatically wrapped in Some, so you don’t need to pass Some(value).
§Example
let obj = Engine::default().with_num_inter_threads(value);Generated by aksr - Builder pattern macro
Sourcepub fn num_inter_threads(&self) -> Option<usize>
pub fn num_inter_threads(&self) -> Option<usize>
Sourcepub fn into_num_inter_threads(self) -> Option<usize>
pub fn into_num_inter_threads(self) -> Option<usize>
Consumes self and returns the num_inter_threads field.
This method moves the owned value out of the struct without cloning.
§Returns
Returns Option
§Example
let obj = Engine::default().with_num_inter_threads(value);
let value = obj.into_num_inter_threads();Generated by aksr - Builder pattern macro
Sourcepub fn take_num_inter_threads(&mut self) -> Option<usize>
pub fn take_num_inter_threads(&mut self) -> Option<usize>
Takes the num_inter_threads field, leaving None in its place.
This method moves the value out and replaces it with None, allowing you to continue using the struct.
§Returns
Returns Option
§Note
This does not require the inner type to implement Default.
§Example
let mut obj = Engine::default().with_num_inter_threads(value);
let value = obj.take_num_inter_threads();
// obj.num_inter_threads is now NoneGenerated by aksr - Builder pattern macro
Sourcepub fn with_hardware(self, x: HardwareConfig) -> Self
pub fn with_hardware(self, x: HardwareConfig) -> Self
Sourcepub fn hardware(&self) -> &HardwareConfig
pub fn hardware(&self) -> &HardwareConfig
Sourcepub fn into_hardware(self) -> HardwareConfig
pub fn into_hardware(self) -> HardwareConfig
Consumes self and returns the hardware field.
This method moves the owned value out of the struct without cloning.
§Returns
Returns the owned value of type HardwareConfig.
§Example
let obj = Engine::default().with_hardware(value);
let value = obj.into_hardware();
// obj is now consumed and cannot be usedGenerated by aksr - Builder pattern macro
Source§impl Engine
impl Engine
pub fn try_from_config(config: &ORTConfig) -> Result<Self>
pub fn build(self) -> Result<Self>
pub fn dry_run(&mut self) -> Result<()>
pub fn run(&mut self, xs: Xs) -> Result<Xs>
pub fn load_onnx<P: AsRef<Path>>(p: P) -> Result<ModelProto>
pub fn batch(&self) -> &MinOptMax
pub fn is_batch_dyn(&self) -> bool
pub fn try_height(&self) -> Option<&MinOptMax>
pub fn height(&self) -> &MinOptMax
pub fn is_height_dyn(&self) -> bool
pub fn try_width(&self) -> Option<&MinOptMax>
pub fn width(&self) -> &MinOptMax
pub fn is_width_dyn(&self) -> bool
pub fn try_fetch(&self, key: &str) -> Option<String>
pub fn ir_version(&self) -> Option<usize>
pub fn opset_version(&self) -> Option<usize>
pub fn producer_name(&self) -> Option<String>
pub fn producer_version(&self) -> Option<String>
pub fn model_version(&self) -> Option<usize>
pub fn ishapes(&self) -> Option<&[Vec<usize>]>
pub fn idimss(&self) -> Option<&[Vec<usize>]>
pub fn inames(&self) -> Option<&[String]>
pub fn idtypes(&self) -> Option<Vec<DType>>
pub fn oshapes(&self) -> Option<&[Vec<usize>]>
pub fn odimss(&self) -> Option<&[Vec<usize>]>
pub fn onames(&self) -> Option<&[String]>
pub fn odtypes(&self) -> Option<Vec<DType>>
pub fn profile(&self)
pub fn info(&self)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Engine
impl !RefUnwindSafe for Engine
impl Send for Engine
impl Sync for Engine
impl Unpin for Engine
impl !UnwindSafe for Engine
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
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>
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>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.