Skip to content

Commit e5ce81a

Browse files
authored
[java] Adding ML program flag for CoreML (#19551)
### Description Adds the new CoreML enum flags to enable ML Program support in Java. ### Motivation and Context Adds support for #19347 to the Java API.
1 parent 57d6819 commit e5ce81a

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

java/src/main/java/ai/onnxruntime/providers/CoreMLFlags.java

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved.
33
* Licensed under the MIT License.
44
*/
55
package ai.onnxruntime.providers;
@@ -14,7 +14,18 @@ public enum CoreMLFlags implements OrtFlags {
1414
/** Enables CoreML on subgraphs. */
1515
ENABLE_ON_SUBGRAPH(2), // COREML_FLAG_ENABLE_ON_SUBGRAPH(0x002)
1616
/** Only enable usage of CoreML if the device has an Apple Neural Engine. */
17-
ONLY_ENABLE_DEVICE_WITH_ANE(4); // COREML_FLAG_ONLY_ENABLE_DEVICE_WITH_ANE(0x004),
17+
ONLY_ENABLE_DEVICE_WITH_ANE(4), // COREML_FLAG_ONLY_ENABLE_DEVICE_WITH_ANE(0x004)
18+
/**
19+
* Only allow CoreML EP to take nodes with inputs with static shapes. By default it will also
20+
* allow inputs with dynamic shapes. However, the performance may be negatively impacted if inputs
21+
* have dynamic shapes.
22+
*/
23+
ONLY_ALLOW_STATIC_INPUT_SHAPES(8), // COREML_FLAG_ONLY_ALLOW_STATIC_INPUT_SHAPES(0x008)
24+
/**
25+
* Create an MLProgram. By default it will create a NeuralNetwork model. Requires Core ML 5 or
26+
* later.
27+
*/
28+
CREATE_MLPROGRAM(16); // COREML_FLAG_CREATE_MLPROGRAM(0x010)
1829

1930
/** The native value of the enum. */
2031
public final int value;

0 commit comments

Comments
 (0)