ort::environment

Function init

Source
pub fn init() -> EnvironmentBuilder
Expand description

Creates an ONNX Runtime environment.

ort::init()
	.with_execution_providers([CUDAExecutionProvider::default().build()])
	.commit()?;

§Notes

  • It is not required to call this function. If this is not called by the time any other ort APIs are used, a default environment will be created.
  • Library crates that use ort shouldn’t create their own environment. Let downstream applications create it.
  • In order for environment settings to apply, this must be called before you use other APIs like Session, and you must call .commit() on the builder returned by this function.