onnxruntime/js/react_native
2021-05-20 09:52:34 -07:00
..
android
example
ios
lib
scripts
.gitignore
.npmignore
babel.config.js
onnxruntime-react-native.iphoneos.podspec
onnxruntime-react-native.iphonesimulator.podspec
package.json
README.md
tsconfig.build.json
tsconfig.json
tsconfig.scripts.json
yarn.lock

onnxruntime-react-native

ONNX Runtime React Native provides a JavaScript library for running ONNX models on React Native app.

Installation

yarn add onnxruntime-react-native

Usage

import { InferenceSession } from "onnxruntime-react-native";

// load a model
const session: InferenceSession = await InferenceSession.create(modelPath);
// input as InferenceSession.OnnxValueMapType
const result = session.run(input, ['num_detection:0', 'detection_classes:0'])

Refer to ONNX Runtime JavaScript examples for samples and tutorials. Different from other JavaScript frameworks like node.js and web, React Native library doesn't support these features

  • Unsigned data type at Tensor
  • Model loading using ArrayBuffer

License

License information can be found here.