HDK
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
coreml_provider_factory.h
Go to the documentation of this file.
1
// Copyright (c) Microsoft Corporation. All rights reserved.
2
// Licensed under the MIT License.
3
#pragma once
4
5
#include "onnxruntime_c_api.h"
6
7
// COREMLFlags are bool options we want to set for CoreML EP
8
// This enum is defined as bit flags, and cannot have negative value
9
// To generate an uint32_t coreml_flags for using with OrtSessionOptionsAppendExecutionProvider_CoreML below,
10
// uint32_t coreml_flags = 0;
11
// coreml_flags |= COREML_FLAG_USE_CPU_ONLY;
12
enum
COREMLFlags
{
13
COREML_FLAG_USE_NONE
= 0x000,
14
15
// Using CPU only in CoreML EP, this may decrease the perf but will provide
16
// reference output value without precision loss, which is useful for validation
17
COREML_FLAG_USE_CPU_ONLY
= 0x001,
18
19
// Enable CoreML EP on subgraph
20
COREML_FLAG_ENABLE_ON_SUBGRAPH
= 0x002,
21
22
// By default CoreML Execution provider will be enabled for all compatible Apple devices
23
// Enable this option will only enable CoreML EP for Apple devices with ANE (Apple Neural Engine)
24
// Please note, enable this option does not guarantee the entire model to be executed using ANE only
25
COREML_FLAG_ONLY_ENABLE_DEVICE_WITH_ANE
= 0x004,
26
27
// Only allow CoreML EP to take nodes with inputs with static shapes. By default it will also allow inputs with
28
// dynamic shapes. However, the performance may be negatively impacted if inputs have dynamic shapes.
29
COREML_FLAG_ONLY_ALLOW_STATIC_INPUT_SHAPES
= 0x008,
30
31
// Create an MLProgram. By default it will create a NeuralNetwork model. Requires Core ML 5 or later.
32
COREML_FLAG_CREATE_MLPROGRAM
= 0x010,
33
34
// Exclude ANE as sometimes this decrease performance
35
// https://developer.apple.com/documentation/coreml/mlcomputeunits?language=objc
36
// there are four compute units:
37
// MLComputeUnitsCPUAndNeuralEngine|MLComputeUnitsCPUAndGPU|MLComputeUnitsCPUOnly|MLComputeUnitsAll
38
COREML_FLAG_USE_CPU_AND_GPU
= 0x020,
39
// Keep COREML_FLAG_LAST at the end of the enum definition
40
// And assign the last COREMLFlag to it
41
COREML_FLAG_LAST
=
COREML_FLAG_USE_CPU_AND_GPU
,
42
};
43
44
#ifdef __cplusplus
45
extern
"C"
{
46
#endif
47
48
ORT_EXPORT
ORT_API_STATUS
(OrtSessionOptionsAppendExecutionProvider_CoreML,
49
_In_ OrtSessionOptions* options, uint32_t coreml_flags);
50
51
#ifdef __cplusplus
52
}
53
#endif
COREML_FLAG_LAST
Definition:
coreml_provider_factory.h:41
COREML_FLAG_ONLY_ALLOW_STATIC_INPUT_SHAPES
Definition:
coreml_provider_factory.h:29
COREML_FLAG_USE_CPU_ONLY
Definition:
coreml_provider_factory.h:17
COREML_FLAG_CREATE_MLPROGRAM
Definition:
coreml_provider_factory.h:32
COREML_FLAG_USE_NONE
Definition:
coreml_provider_factory.h:13
COREML_FLAG_ONLY_ENABLE_DEVICE_WITH_ANE
Definition:
coreml_provider_factory.h:25
COREML_FLAG_USE_CPU_AND_GPU
Definition:
coreml_provider_factory.h:38
COREMLFlags
COREMLFlags
Definition:
coreml_provider_factory.h:12
COREML_FLAG_ENABLE_ON_SUBGRAPH
Definition:
coreml_provider_factory.h:20
ORT_API_STATUS
ORT_EXPORT ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_CoreML, _In_ OrtSessionOptions *options, uint32_t coreml_flags)
onnxruntime
core
providers
coreml
coreml_provider_factory.h
Generated on Wed Aug 27 2025 03:06:50 for HDK by
1.8.6