onnxruntime/docs/tutorials/mobile/model-execution.md
Edward Chen 3c9ca35f93
[Docs] Update mobile docs for 1.9 (#9237)
* Edgchen1/objc api reference 1.9 (#1)

* Update Objective-C API reference for 1.9.

* Update spelling.

* Test link changes.

* Fix links.

* Fix links and updates in mobile-performance-tuning.md.

* Fix links in tutorials/mobile/custom-build.md.

* Fix

* Fix

* Fix links in docs/tutorials/mobile/initial-setup.md.

* Fix links.

* Update note.

* Add 1.9 op type support page.

* Add nav info to page.

* Rename files to not have spaces.
2021-10-04 15:48:53 -07:00

1.5 KiB

title parent grand_parent has_children nav_order
Model Execution Deploy ONNX Runtime Mobile Tutorials false 5

{::options toc_levels="2..4" /}

Executing an ORT format model

The API for executing ORT format models is the same as for ONNX models.

See the ONNX Runtime API documentation for details on individual API usage.

APIs by platform

Platform Available APIs
Android C, C++, Java
iOS C, C++, Objective-C (Swift via bridge)

ORT format model loading

If you provide a filename for the ORT format model, a file extension of '.ort' will be inferred to be an ORT format model.

If you provide in-memory bytes for the ORT format model, a marker in those bytes will be checked to infer if it's an ORT format model.

If you wish to explicitly say that the InferenceSession input is an ORT format model you can do so via SessionOptions, although this generally should not be necessary.

C++ API

Ort::SessionOptions session_options;
session_options.AddConfigEntry('session.load_model_format', 'ORT');

Ort::Env env;
Ort::Session session(env, <path to model>, session_options);

Java API

SessionOptions session_options = new SessionOptions();
session_options.addConfigEntry("session.load_model_format", "ORT");

OrtEnvironment env = OrtEnvironment.getEnvironment();
OrtSession session = env.createSession(<path to model>, opsession_optionstions);

Next: Using NNAPI and CoreML with ORT Mobile