Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
onnxruntime-common
Advanced tools
The onnxruntime-common npm package provides common utilities and types for the ONNX Runtime JavaScript API. It is typically used in conjunction with other ONNX Runtime packages to facilitate the loading, running, and managing of ONNX models in JavaScript environments.
Model Management
This feature allows you to load an ONNX model into an inference session. The code sample demonstrates how to create an inference session from a model file.
const { InferenceSession } = require('onnxruntime-common');
async function loadModel(modelPath) {
const session = await InferenceSession.create(modelPath);
console.log('Model loaded successfully');
return session;
}
loadModel('path/to/model.onnx');
Inference
This feature allows you to run inference on an ONNX model. The code sample demonstrates how to create a tensor from input data, feed it into the model, and retrieve the inference results.
const { InferenceSession, Tensor } = require('onnxruntime-common');
async function runInference(session, inputData) {
const inputTensor = new Tensor('float32', inputData, [1, inputData.length]);
const feeds = { input: inputTensor };
const results = await session.run(feeds);
console.log('Inference results:', results);
return results;
}
(async () => {
const session = await InferenceSession.create('path/to/model.onnx');
const inputData = new Float32Array([1.0, 2.0, 3.0, 4.0]);
await runInference(session, inputData);
})();
Tensor Management
This feature allows you to create and manage tensors, which are the primary data structure used in ONNX models. The code sample demonstrates how to create a tensor from a data array and dimensions.
const { Tensor } = require('onnxruntime-common');
function createTensor(data, dims) {
const tensor = new Tensor('float32', data, dims);
console.log('Tensor created:', tensor);
return tensor;
}
const data = new Float32Array([1.0, 2.0, 3.0, 4.0]);
const dims = [2, 2];
createTensor(data, dims);
TensorFlow.js is a library for developing and training machine learning models in JavaScript. It provides a comprehensive set of tools for working with machine learning models, including model management, inference, and tensor operations. Compared to onnxruntime-common, TensorFlow.js offers a broader range of functionalities and is more widely used in the JavaScript machine learning community.
Brain.js is a JavaScript library for neural networks. It provides simple and flexible APIs for creating, training, and running neural networks in JavaScript. While it does not support ONNX models, it offers an easy-to-use interface for building and deploying neural networks, making it a good alternative for simpler machine learning tasks.
Synaptic is a JavaScript neural network library for node.js and the browser. It provides a modular and extensible framework for building and training neural networks. Although it does not support ONNX models, it offers a flexible and lightweight solution for neural network development in JavaScript.
ONNX Runtime JavaScript API is a unified API for all JavaScript usages. It's dependency of the following NPM packages:
This package (onnxruntime-common) is not designed for using directly. Please consider to install one of the NPM packages above according to target platform.
License information can be found here.
FAQs
ONNXRuntime JavaScript API library
The npm package onnxruntime-common receives a total of 54,380 weekly downloads. As such, onnxruntime-common popularity was classified as popular.
We found that onnxruntime-common demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
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.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.