Engine

Struct Engine 

Source
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: String

Model file path.

§spec: String

Model specification string.

§device: Device

Execution 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: usize

Number of dry runs for warmup.

§graph_opt_level: Option<u8>§num_intra_threads: Option<usize>§num_inter_threads: Option<usize>§hardware: HardwareConfig

Hardware-specific configurations for all execution providers

Implementations§

Source§

impl Engine

Source

pub fn with_file(self, x: &str) -> Self

Sets the file field from a string slice.

§Arguments
  • x - A string slice that will be converted to String
§Returns

Returns Self for method chaining.

§Example
let obj = Engine::default().with_file("value");

Generated by aksr - Builder pattern macro

Source

pub fn file(&self) -> &str

Returns a string slice of the file field.

§Example
let obj = Engine::default();
let value = obj.file();

Generated by aksr - Builder pattern macro

Source

pub fn with_spec(self, x: &str) -> Self

Sets the spec field from a string slice.

§Arguments
  • x - A string slice that will be converted to String
§Returns

Returns Self for method chaining.

§Example
let obj = Engine::default().with_spec("value");

Generated by aksr - Builder pattern macro

Source

pub fn spec(&self) -> &str

Returns a string slice of the spec field.

§Example
let obj = Engine::default();
let value = obj.spec();

Generated by aksr - Builder pattern macro

Source

pub fn with_device(self, x: Device) -> Self

Sets the device field.

§Arguments
  • x - The new value to be assigned
§Returns

Returns Self for method chaining.

§Example
let obj = Engine::default().with_device(value);

Generated by aksr - Builder pattern macro

Source

pub fn device(&self) -> &Device

Returns a reference to the device field.

§Example
let obj = Engine::default();
let value = obj.device();

Generated by aksr - Builder pattern macro

Source

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

Source

pub fn with_iiixs_extend(self, x: &[Iiix]) -> Self

Appends elements to the iiixs field.

§Arguments
  • x - A slice of elements to append to the vector
§Returns

Returns Self for method chaining.

§Example
let obj = Engine::default().with_iiixs_extend(&[item1, item2]);

Generated by aksr - Builder pattern macro

Source

pub fn iiixs(&self) -> &[Iiix]

Returns a slice view of the iiixs field.

§Example
let obj = Engine::default();
let items = obj.iiixs();

Generated by aksr - Builder pattern macro

Source

pub fn with_parameters(self, x: usize) -> Self

Sets the optional params field.

§Arguments
  • x - The value that will be automatically wrapped in Some
§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

Source

pub fn parameters(&self) -> Option<usize>

Returns the value of the optional params field.

§Example
let obj = Engine::default();
let value = obj.parameters();

Generated by aksr - Builder pattern macro

Source

pub fn with_memory(self, x: usize) -> Self

Sets the optional wbmems field.

§Arguments
  • x - The value that will be automatically wrapped in Some
§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

Source

pub fn memory(&self) -> Option<usize>

Returns the value of the optional wbmems field.

§Example
let obj = Engine::default();
let value = obj.memory();

Generated by aksr - Builder pattern macro

Source

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

Source

pub fn inputs_minoptmax(&self) -> &[Vec<MinOptMax>]

Returns a slice view of the inputs_minoptmax field.

§Example
let obj = Engine::default();
let items = obj.inputs_minoptmax();

Generated by aksr - Builder pattern macro

Source

pub fn with_onnx(self, x: OnnxIo) -> Self

Sets the optional onnx field.

§Arguments
  • x - The value that will be automatically wrapped in Some
§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

Source

pub fn onnx(&self) -> Option<&OnnxIo>

Returns an optional reference to the onnx field.

§Example
let obj = Engine::default();
let value = obj.onnx();

Generated by aksr - Builder pattern macro

Source

pub fn with_num_dry_run(self, x: usize) -> Self

Sets the num_dry_run field.

§Arguments
  • x - The new value to be assigned
§Returns

Returns Self for method chaining.

§Example
let obj = Engine::default().with_num_dry_run(value);

Generated by aksr - Builder pattern macro

Source

pub fn num_dry_run(&self) -> usize

Returns the value of the num_dry_run field.

§Example
let obj = Engine::default();
let value = obj.num_dry_run();

Generated by aksr - Builder pattern macro

Source

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 in Some
§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

Source

pub fn graph_opt_level(&self) -> Option<u8>

Returns the value of the optional graph_opt_level field.

§Example
let obj = Engine::default();
let value = obj.graph_opt_level();

Generated by aksr - Builder pattern macro

Source

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 in Some
§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

Source

pub fn num_intra_threads(&self) -> Option<usize>

Returns the value of the optional num_intra_threads field.

§Example
let obj = Engine::default();
let value = obj.num_intra_threads();

Generated by aksr - Builder pattern macro

Source

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 in Some
§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

Source

pub fn num_inter_threads(&self) -> Option<usize>

Returns the value of the optional num_inter_threads field.

§Example
let obj = Engine::default();
let value = obj.num_inter_threads();

Generated by aksr - Builder pattern macro

Source

pub fn with_hardware(self, x: HardwareConfig) -> Self

Sets the hardware field.

§Arguments
  • x - The new value to be assigned
§Returns

Returns Self for method chaining.

§Example
let obj = Engine::default().with_hardware(value);

Generated by aksr - Builder pattern macro

Source

pub fn hardware(&self) -> &HardwareConfig

Returns a reference to the hardware field.

§Example
let obj = Engine::default();
let value = obj.hardware();

Generated by aksr - Builder pattern macro

Source§

impl Engine

Source

pub fn try_from_config(config: &ORTConfig) -> Result<Self>

Source

pub fn build(self) -> Result<Self>

Source

pub fn dry_run(&mut self) -> Result<()>

Source

pub fn run(&mut self, xs: Xs) -> Result<Xs>

Source

pub fn load_onnx<P: AsRef<Path>>(p: P) -> Result<ModelProto>

Source

pub fn batch(&self) -> &MinOptMax

Source

pub fn is_batch_dyn(&self) -> bool

Source

pub fn try_height(&self) -> Option<&MinOptMax>

Source

pub fn height(&self) -> &MinOptMax

Source

pub fn is_height_dyn(&self) -> bool

Source

pub fn try_width(&self) -> Option<&MinOptMax>

Source

pub fn width(&self) -> &MinOptMax

Source

pub fn is_width_dyn(&self) -> bool

Source

pub fn try_fetch(&self, key: &str) -> Option<String>

Source

pub fn ir_version(&self) -> Option<usize>

Source

pub fn opset_version(&self) -> Option<usize>

Source

pub fn producer_name(&self) -> Option<String>

Source

pub fn producer_version(&self) -> Option<String>

Source

pub fn model_version(&self) -> Option<usize>

Source

pub fn ishapes(&self) -> Option<&[Vec<usize>]>

Source

pub fn idimss(&self) -> Option<&[Vec<usize>]>

Source

pub fn inames(&self) -> Option<&[String]>

Source

pub fn idtypes(&self) -> Option<Vec<DType>>

Source

pub fn oshapes(&self) -> Option<&[Vec<usize>]>

Source

pub fn odimss(&self) -> Option<&[Vec<usize>]>

Source

pub fn onames(&self) -> Option<&[String]>

Source

pub fn odtypes(&self) -> Option<Vec<DType>>

Source

pub fn profile(&self)

Source

pub fn info(&self)

Trait Implementations§

Source§

impl Debug for Engine

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Engine

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V