refactor: rename SessionBuilder commit methods

This commit is contained in:
Carson M.
2024-02-28 21:17:54 -06:00
parent aff658ee36
commit 33938fde8b
21 changed files with 67 additions and 77 deletions

View File

@@ -13,7 +13,7 @@ fn mnist_5() -> ort::Result<()> {
let session = Session::builder()?
.with_optimization_level(GraphOptimizationLevel::Level1)?
.with_intra_threads(1)?
.with_model_downloaded("https://parcel.pyke.io/v2/cdn/assetdelivery/ortrsv2/ex_models/mnist.onnx")
.commit_from_url("https://parcel.pyke.io/v2/cdn/assetdelivery/ortrsv2/ex_models/mnist.onnx")
.expect("Could not download model from file");
let metadata = session.metadata()?;

View File

@@ -19,7 +19,7 @@ fn squeezenet_mushroom() -> ort::Result<()> {
let session = Session::builder()?
.with_optimization_level(GraphOptimizationLevel::Level1)?
.with_intra_threads(1)?
.with_model_downloaded("https://parcel.pyke.io/v2/cdn/assetdelivery/ortrsv2/ex_models/squeezenet.onnx")
.commit_from_url("https://parcel.pyke.io/v2/cdn/assetdelivery/ortrsv2/ex_models/squeezenet.onnx")
.expect("Could not download model from file");
let metadata = session.metadata()?;

View File

@@ -51,7 +51,7 @@ fn upsample() -> ort::Result<()> {
let session = Session::builder()?
.with_optimization_level(GraphOptimizationLevel::Level1)?
.with_intra_threads(1)?
.with_model_from_memory(&session_data)
.commit_from_memory(&session_data)
.expect("Could not read model from memory");
let metadata = session.metadata()?;
@@ -92,7 +92,7 @@ fn upsample_with_ort_model() -> ort::Result<()> {
let session = Session::builder()?
.with_optimization_level(GraphOptimizationLevel::Level1)?
.with_intra_threads(1)?
.with_model_from_memory_directly(&session_data) // Zero-copy.
.commit_from_memory_directly(&session_data) // Zero-copy.
.expect("Could not read model from memory");
assert_eq!(session.inputs[0].input_type.tensor_dimensions().expect("input0 to be a tensor type"), &[-1, -1, -1, 3]);

View File

@@ -11,7 +11,7 @@ fn vectorizer() -> ort::Result<()> {
let session = Session::builder()?
.with_optimization_level(GraphOptimizationLevel::Level1)?
.with_intra_threads(1)?
.with_model_from_file(Path::new(env!("CARGO_MANIFEST_DIR")).join("tests").join("data").join("vectorizer.onnx"))
.commit_from_file(Path::new(env!("CARGO_MANIFEST_DIR")).join("tests").join("data").join("vectorizer.onnx"))
.expect("Could not load model");
let metadata = session.metadata()?;