郭睿 74a0b5a78f 修改忽略文件 | 1 jaar geleden | |
---|---|---|
.. | ||
build | 1 jaar geleden | |
runtimes | 1 jaar geleden | |
.signature.p7s | 1 jaar geleden | |
LICENSE.txt | 1 jaar geleden | |
Microsoft.ML.OnnxRuntime.1.6.0.nupkg | 1 jaar geleden | |
Privacy.md | 1 jaar geleden | |
README.md | 1 jaar geleden | |
ThirdPartyNotices.txt | 1 jaar geleden |
OrtCreateSessionFromArray
in onnxruntime_c_api.h.ThreadingOptions
. Use the value of 0 for ORT to pick the defaults.CreateEnvWithGlobalThreadPools()
DisablePerSessionThreads()
on the session options objectRun()
as usualShare allocator(s) between sessions:
CreateAndRegisterAllocator
API. This allocator is then reused by all sessions that use the same env instance unless a session
chooses to override this by setting session_state.use_env_allocators
to "0".session.use_env_allocators
to "1" for each session that wants to use the env registered allocators.TestSharedAllocatorUsingCreateAndRegisterAllocator
in
onnxruntime/test/shared_lib/test_inference.cc for an example.initial_chunk_size_bytes
: This is the size of the region that the arena allocates first. Chunks are handed over to allocation requests from this region. If the logs show that the arena is getting extended a lot more than expected, you're better off choosing a big enough initial size for this.max_mem
: This is the maximum amount of memory the arena allocates. If a chunk cannot be serviced by any existing region, the arena extends itself by allocating one more region depending on available memory (max_mem - allocated_so_far). An error is returned if available memory is less than the requested extension.arena_extend_strategy
: This can take only 2 values currently: kSameAsRequested or kNextPowerOfTwo. As the name suggests kNextPowerOfTwo (the default) extends the arena by a power of 2, while kSameAsRequested extends by a size that is the same as the allocation request each time. kSameAsRequested is suited for more advanced configurations where you know the expected memory usage in advance.max_dead_bytes_per_chunk
: This controls whether a chunk is split to service an allocation request. Currently if the difference between the chunk size and requested size is less than this value, the chunk is not split. This has the potential to waste memory by keeping a part of the chunk unused (hence called dead bytes) throughout the process thereby increasing the memory usage (until this chunk is returned to the arena).Share initializer(s) between sessions:
AddInitializer
API to add a pre-allocated initializer to session options before calling CreateSession
. Use the same instance of session options to create several sessions allowing the initializer(s) to be shared between the sessions. See C API sample usage (TestSharingOfInitializer) and C# API sample usage (TestWeightSharingBetweenSessions).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.
Your installer should put the onnxruntime.dll into the same folder as your application. Your application can either use load-time dynamic linking or run-time dynamic linking to bind to the dll.
This is an important article on how Windows finds supporting dlls: Dynamic Link Library Search Order.
There are some cases where the app is not directly consuming the onnxruntime but instead calling into a DLL that is consuming the onnxruntime. People building these DLLs that consume the onnxruntime need to take care about folder structures. Do not modify the system %path% variable to add your folders. This can conflict with other software on the machine that is also using the onnxruntme. Instead place your DLL and the onnxruntime DLL in the same folder and use run-time dynamic linking to bind explicity to that copy. You can use code like this sample does in GetModulePath() to find out what folder your dll is loaded from.
To turn on/off telemetry collection on official Windows builds, please use Enable/DisableTelemetryEvents() in the C API. See the Privacy page for more information on telemetry collection and Microsoft's privacy policy.