Ejemplo n.º 1
0
        /// <summary>
        /// Use only if you have the onnxruntime package specific to this Execution Provider.
        /// </summary>
        /// <param name="coremlFlags">CoreML specific flags</param>
        public void AppendExecutionProvider_CoreML(CoreMLFlags coremlFlags = CoreMLFlags.COREML_FLAG_USE_NONE)
        {
#if __IOS__
            NativeApiStatus.VerifySuccess(
                NativeMethods.OrtSessionOptionsAppendExecutionProvider_CoreML(handle, (uint)coremlFlags));
#else
            throw new NotSupportedException("The CoreML Execution Provider is not supported in this build");
#endif
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Use only if you have the onnxruntime package specific to this Execution Provider.
        /// </summary>
        /// <param name="coremlFlags">CoreML specific flags</param>
        public void AppendExecutionProvider_CoreML(CoreMLFlags coremlFlags = CoreMLFlags.COREML_FLAG_USE_NONE)
        {
#if __IOS__
            NativeApiStatus.VerifySuccess(
                NativeMethods.OrtSessionOptionsAppendExecutionProvider_CoreML(handle, (uint)coremlFlags));
#else
#if !__ANDROID__
            // the CoreML EP entry point is registered unless this is Android but is only valid if this is OSX
            if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
            {
                NativeApiStatus.VerifySuccess(
                    NativeMethods.OrtSessionOptionsAppendExecutionProvider_CoreML(handle, (uint)coremlFlags));
            }
            else
#endif
            {
                throw new NotSupportedException("The CoreML Execution Provider is not supported in this build");
            }
#endif
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Use only if you have the onnxruntime package specific to this Execution Provider.
        /// </summary>
        /// <param name="coremlFlags">CoreML specific flags</param>
        public void AppendExecutionProvider_CoreML(CoreMLFlags coremlFlags = CoreMLFlags.COREML_FLAG_USE_NONE)
        {
#if __IOS__
            NativeApiStatus.VerifySuccess(
                NativeMethods.OrtSessionOptionsAppendExecutionProvider_CoreML(handle, (uint)coremlFlags));
#else
#if __ENABLE_COREML__
            // only attempt if this is OSX
            if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
            {
                NativeApiStatus.VerifySuccess(
                    NativeMethods.OrtSessionOptionsAppendExecutionProvider_CoreML(handle, (uint)coremlFlags));
            }
            else
#endif
            {
                throw new NotSupportedException("The CoreML Execution Provider is not supported in this build");
            }
#endif
        }