mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-24 19:43:35 +00:00
add details aboud adding execution providers in the C api to comments and docs (i.e. need OrtSessionOptionsAppendExecutionProvider_CUDA to get CUDA)
This commit is contained in:
parent
6c9d815de5
commit
10ea77a3d1
2 changed files with 8 additions and 4 deletions
|
|
@ -39,6 +39,10 @@ int main(int argc, char* argv[]) {
|
|||
// 2 -> To enable all optimizations (Includes level 1 + more complex optimizations like node fusions)
|
||||
OrtSetSessionGraphOptimizationLevel(session_options, 1);
|
||||
|
||||
// Optionally add more execution providers via session_options
|
||||
// E.g. for CUDA include cuda_provider_factory.h and uncomment the following line:
|
||||
// OrtSessionOptionsAppendExecutionProvider_CUDA(sessionOptions, 0);
|
||||
|
||||
//*************************************************************************
|
||||
// create session and load model into memory
|
||||
// using squeezenet version 1.3
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@
|
|||
* Creating an InferenceSession from an on-disk model file and a set of SessionOptions.
|
||||
* Registering customized loggers.
|
||||
* Registering customized allocators.
|
||||
* Registering predefined providers and set the priority order. ONNXRuntime has a set of predefined execution providers,like CUDA, MKLDNN. User can register providers to their InferenceSession. The order of registration indicates the preference order as well.
|
||||
* Registering predefined providers and set the priority order. ONNXRuntime has a set of predefined execution providers, like CUDA, MKLDNN. User can register providers to their InferenceSession. The order of registration indicates the preference order as well.
|
||||
* Running a model with inputs. These inputs must be in CPU memory, not GPU. If the model has multiple outputs, user can specify which outputs they want.
|
||||
* Converting an in-memory ONNX Tensor encoded in protobuf format, to a pointer that can be used as model input.
|
||||
* Converting an in-memory ONNX Tensor encoded in protobuf format to a pointer that can be used as model input.
|
||||
* Setting the thread pool size for each session.
|
||||
* Setting graph optimization level for each session.
|
||||
* Dynamically loading custom ops. [Instructions](/docs/AddingCustomOp.md)
|
||||
|
|
@ -17,6 +17,7 @@
|
|||
1. Include [onnxruntime_c_api.h](/include/onnxruntime/core/session/onnxruntime_c_api.h).
|
||||
2. Call OrtCreateEnv
|
||||
3. Create Session: OrtCreateSession(env, model_uri, nullptr,...)
|
||||
- Optionally add more execution providers (e.g. for CUDA use OrtSessionOptionsAppendExecutionProvider_CUDA)
|
||||
4. Create Tensor
|
||||
1) OrtCreateAllocatorInfo
|
||||
2) OrtCreateTensorWithDataAsOrtValue
|
||||
|
|
@ -24,7 +25,6 @@
|
|||
|
||||
## Sample code
|
||||
|
||||
The example below shows a sample run using the SqueezeNet model from ONNX model zoo, including dynamically reading model inputs, outputs, shape and type information, as well as running a sample vector and fetching the resulting class probabilities for inspection.
|
||||
The example below shows a sample run using the SqueezeNet model from ONNX model zoo, including dynamically reading model inputs, outputs, shape and type information, as well as running a sample vector and fetching the resulting class probabilities for inspection.
|
||||
|
||||
* [../csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests.Capi/C_Api_Sample.cpp](../csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests.Capi/C_Api_Sample.cpp)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue