ONNX Runtime

跨平台 ML 推理引擎 · 官方链接

简介

ONNX Runtime 是微软开源的机器学习推理引擎,支持 ONNX 格式模型的高性能推理。支持 CPU、GPU、NPU 等多种硬件后端,广泛用于语音识别、图像处理等 AI 应用。

特性

安装

# Python
pip install onnxruntime
# Node.js
npm install onnxruntime-node
# GPU 版本(CUDA)
pip install onnxruntime-gpu

常用命令

# Python 推理
import onnxruntime as ort
session = ort.InferenceSession("model.onnx")
result = session.run(None, {"input": data})
# Node.js 推理
const ort = require("onnxruntime-node")
const session = await ort.InferenceSession.create("model.onnx")
更多信息请访问 ONNX Runtime 官方网站