mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-28 22:56:32 +00:00
Fixing CoreML in Java (#16231)
### Description The name of the flag we set when compiling the JNI binding to enable the CoreML EP changed at some point in the past. This PR fixes it by updating the flag in the JNI. I also added a quick smoke test for the CoreML provider to make sure it doesn't crash and can be enabled. ### Motivation and Context All the EPs should work as expected in Java. Fixes #16230.
This commit is contained in:
parent
1261d0b8ba
commit
bca49d62a0
3 changed files with 8 additions and 2 deletions
|
|
@ -181,7 +181,7 @@ test {
|
|||
if (cmakeBuildDir != null) {
|
||||
workingDir cmakeBuildDir
|
||||
}
|
||||
systemProperties System.getProperties().subMap(['USE_CUDA', 'USE_ROCM', 'USE_TENSORRT', 'USE_DNNL', 'USE_OPENVINO', 'JAVA_FULL_TEST', 'ENABLE_TRAINING_APIS'])
|
||||
systemProperties System.getProperties().subMap(['USE_CUDA', 'USE_ROCM', 'USE_TENSORRT', 'USE_DNNL', 'USE_OPENVINO', 'USE_COREML', 'JAVA_FULL_TEST', 'ENABLE_TRAINING_APIS'])
|
||||
testLogging {
|
||||
events "passed", "skipped", "failed"
|
||||
showStandardStreams = true
|
||||
|
|
|
|||
|
|
@ -600,7 +600,7 @@ JNIEXPORT void JNICALL Java_ai_onnxruntime_OrtSession_00024SessionOptions_addArm
|
|||
JNIEXPORT void JNICALL Java_ai_onnxruntime_OrtSession_00024SessionOptions_addCoreML
|
||||
(JNIEnv * jniEnv, jobject jobj, jlong apiHandle, jlong handle, jint coreMLFlags) {
|
||||
(void)jobj;
|
||||
#ifdef USE_CORE_ML
|
||||
#ifdef USE_COREML
|
||||
checkOrtStatus(jniEnv,(const OrtApi*)apiHandle,OrtSessionOptionsAppendExecutionProvider_CoreML((OrtSessionOptions*) handle, (uint32_t) coreMLFlags));
|
||||
#else
|
||||
(void)apiHandle;(void)handle;(void)coreMLFlags; // Parameters used when CoreML is defined.
|
||||
|
|
|
|||
|
|
@ -632,6 +632,12 @@ public class InferenceTest {
|
|||
runProvider(OrtProvider.XNNPACK);
|
||||
}
|
||||
|
||||
@Test
|
||||
@EnabledIfSystemProperty(named = "USE_COREML", matches = "1")
|
||||
public void testCoreML() throws OrtException {
|
||||
runProvider(OrtProvider.CORE_ML);
|
||||
}
|
||||
|
||||
private void runProvider(OrtProvider provider) throws OrtException {
|
||||
EnumSet<OrtProvider> providers = OrtEnvironment.getAvailableProviders();
|
||||
assertTrue(providers.size() > 1);
|
||||
|
|
|
|||
Loading…
Reference in a new issue