mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-17 21:10:43 +00:00
### Description <!-- Describe your changes. --> This PR adds support for `executionProviders` option for react-native package, support: - Android: cpu / xnnpack / nnapi - iOS: cpu / xnnpack / coreml ### Motivation and Context <!-- - Why is this change required? What problem does it solve? - If it fixes an open issue, please link to the issue here. --> In my case I want to enable Core ML / NNAPI EP for react-native project.
18 lines
624 B
TypeScript
18 lines
624 B
TypeScript
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
|
|
export * from 'onnxruntime-common';
|
|
import {registerBackend, env} from 'onnxruntime-common';
|
|
import {Platform} from 'react-native';
|
|
import {onnxruntimeBackend} from './backend';
|
|
import {version} from './version';
|
|
|
|
registerBackend('cpu', onnxruntimeBackend, 1);
|
|
registerBackend('xnnpack', onnxruntimeBackend, 1);
|
|
if (Platform.OS === 'android') {
|
|
registerBackend('nnapi', onnxruntimeBackend, 1);
|
|
} else if (Platform.OS === 'ios') {
|
|
registerBackend('coreml', onnxruntimeBackend, 1);
|
|
}
|
|
|
|
env.versions['react-native'] = version;
|