npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@numrs/node

v0.1.23

Published

Node.js bindings for NumRs

Readme

@numrs/node

NumRs Node is the native Node.js binding for the NumRs numerical engine. It provides high-performance, hardware-accelerated (Metal/Accelerate on macOS, MKL/OpenBLAS elsewhere) tensor operations and deep learning capabilities.

🚀 Features

  • Hardware Acceleration: Uses Metal on Apple Silicon for GPU-like performance.
  • Multithreading: Native parallelization via Rayon.
  • Zero-Copy: Efficient memory sharing between Node.js and Rust.
  • Deep Learning: Full Autograd engine and Neural Network modules.
  • Type Safe: Full TypeScript support.

📦 Installation

npm install @numrs/node

Note: Requires Rust to be installed on your system to compile the native extension.

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

🎯 Usage

Quick Start: Tensors & Autograd

import { Tensor, nn } from '@numrs/node';

// Create tensors with autograd enabled
const x = Tensor.randn([2, 5], true); 
const w = Tensor.randn([5, 10], true);

// Fast matrix multiplication
const y = x.matmul(w);

// Backward pass
y.backward();
console.log("Gradient:", x.grad());

Deep Learning Model

import { Sequential, nn } from '@numrs/node';

const model = new Sequential();
model.add_linear(new nn.Linear(10, 32));
model.add_relu(new nn.ReLU());
model.add_linear(new nn.Linear(32, 2));

// Forward pass
const input = Tensor.randn([100, 10]);
const output = model.forward(input);

Training Loop

Use the TrainerBuilder for a highly optimized, native training loop.

import { TrainerBuilder, Dataset } from '@numrs/node';

// 1. Prepare Data
const input = Tensor.randn([100, 10]);
const target = Tensor.randn([100, 2]);
const dataset = new Dataset(input, target);

// 2. Train
const trainer = new TrainerBuilder(model, dataset)
    .batch_size(16)
    .learning_rate(0.01)
    .optimizer("adam") // Supports: adam, sgd, rmsprop, etc.
    .loss("mse")       // Supports: mse, cross_entropy
    .max_epochs(50)
    .build();

const history = trainer.fit();
console.log("Final Loss:", history.final_loss);

🧠 Optimizers & Loss Functions

| Category | Supported Algorithms | | :----------------- | :--------------------------------------------------------------------------------------------------------------------------------------- | | Optimizers | "sgd", "adam", "adamw", "nadam", "radam", "rmsprop", "adagrad", "adadelta", "lamb", "adabound", "lbfgs", "rprop" | | Loss Functions | "mse" (Regression), "cross_entropy" (Classification) |

🔍 Advanced Features

Zero-Copy Float32Array Ops

For raw numerical computing, you can operate directly on Float32Array buffers without Tensor overhead.

const numrs = require('@numrs/node');
const a = new Float32Array([1, 2, 3, 4]);
const b = new Float32Array([5, 6, 7, 8]);
// Element-wise addition
const c = numrs.add(a, [2, 2], b, [2, 2]); 

ONNX Export

Export your trained models to ONNX for verifying graphs or interoperability.

model.save_onnx(dummy_input, "model.onnx");

📚 Documentation

For full API documentation, please refer to the main NumRs Repository.

License

AGPL-3.0-only