Socket
Book a DemoInstallSign in
Socket

onnxruntime-node

Package Overview
Dependencies
Maintainers
2
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

onnxruntime-node

ONNXRuntime Node.js binding

1.22.0-rev
latest
Source
npmnpm
Version published
Weekly downloads
333K
-18.84%
Maintainers
2
Weekly downloads
 
Created

What is onnxruntime-node?

The onnxruntime-node package is a Node.js binding for the ONNX Runtime, which is a cross-platform, high-performance scoring engine for Open Neural Network Exchange (ONNX) models. It allows developers to run machine learning models in Node.js applications efficiently.

What are onnxruntime-node's main functionalities?

Load and Run ONNX Models

This feature allows you to load an ONNX model and run inference on it using the onnxruntime-node package. The code sample demonstrates how to create an inference session, prepare input data, and execute the model to get the output.

const ort = require('onnxruntime-node');

async function runModel() {
  const session = await ort.InferenceSession.create('./model.onnx');
  const input = { input: new ort.Tensor('float32', [1, 2, 3, 4], [2, 2]) };
  const output = await session.run(input);
  console.log(output);
}

runModel();

Model Optimization

This feature provides options to optimize the ONNX model for better performance. The code sample shows how to set optimization options when creating an inference session, which can lead to faster inference times.

const ort = require('onnxruntime-node');

async function optimizeModel() {
  const sessionOptions = {
    graphOptimizationLevel: 'all'
  };
  const session = await ort.InferenceSession.create('./model.onnx', sessionOptions);
  console.log('Model optimized and loaded');
}

optimizeModel();

Other packages similar to onnxruntime-node

Keywords

ONNX

FAQs

Package last updated on 02 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.