Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

onnxruntime-node

Package Overview
Dependencies
Maintainers
0
Versions
77
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.20.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
111K
decreased by-18.31%
Maintainers
0
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

FAQs

Package last updated on 22 Nov 2024

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc