pub struct Environment { /* private fields */ }
Expand description
An Environment
is the main entry point of the ONNX Runtime.
Only one ONNX environment can be created per process. The onnxruntime
crate
uses a singleton (through lazy_static!()
) to enforce this.
Once an environment is created, a Session
can be obtained from it.
NOTE: While the Environment
constructor takes a name
parameter
to name the environment, only the first name will be considered if many environments
are created.
§Example
let environment = Environment::builder()
.with_name("test")
.with_log_level(LoggingLevel::Verbose)
.build()?;
Implementations§
Source§impl Environment
impl Environment
Sourcepub fn builder() -> EnvBuilder
pub fn builder() -> EnvBuilder
Create a new environment builder using default values
(name: default
, log level: LoggingLevel::Warning)
Sourcepub fn new_session_builder(&self) -> Result<SessionBuilder<'_>>
pub fn new_session_builder(&self) -> Result<SessionBuilder<'_>>
Create a new SessionBuilder
used to create a new ONNX session.
Trait Implementations§
Source§impl Clone for Environment
impl Clone for Environment
Source§fn clone(&self) -> Environment
fn clone(&self) -> Environment
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 Environment
impl Debug for Environment
Auto Trait Implementations§
impl Freeze for Environment
impl RefUnwindSafe for Environment
impl Send for Environment
impl Sync for Environment
impl Unpin for Environment
impl UnwindSafe for Environment
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