TypeScript icon, indicating that this package has built-in type declarations

1.4.9 • Public • Published



RECURRENT-js-GPU is a GPU-supported, object-oriented Javascript library (baked with Typescript). It is a refactored port of Andrej Karpathy's RecurrentJS library that implements the following:

  • Deep Recurrent Neural Networks (RNN)
  • Long Short-Term Memory networks (LSTM)
  • In fact, the library is more general because it has functionality to construct arbitrary expression graphs over which the library can perform automatic differentiation similar to what you may find in Theano for Python, or in Torch etc. Currently, the code uses this very general functionality to implement RNN/LSTM, but one can build arbitrary Neural Networks and do automatic backprop.

For further Information see the recurrentjs repository.

For Production Use

How to install as dependency

Download available @npm: recurrent-js-gpu

Install via command line:

npm install --save recurrent-js-gpu

How To use the Library in Production

Currently exposed Classes:

  • Utility Classes:

    • R - Collection of Utility functions
    • Mat - Sophisticated Matrix Structure for Weights in Networks.
    • RandMat - Mat populated with random gaussian distributed values
    • Graph - Graph holding the Operations
    • NNModel - Genralized Class containing the Weights (and Graph) for RNN and LSTM
    • PreviousOutputs - Standardized Interface for parameter injection in forward-pass of NNModels.
  • Network Classes:

    • Net - Simple Neural Network
    • RNN - Recurrent Neural Network. Extends NNModel.
    • LSTM - Long Short Term Memory Network. Extends NNModel.

These classes can be imported from this npm module, e.g.:

import { Graph, Net } from 'recurrent-js-gpu';

For JavaScript usage require classes from this npm module as follows:

const Graph = require('recurrent-js-gpu').Graph;
const Net = require('recurrent-js-gpu').Net;

GPU-Accelerated Matrix-Operations

This project uses GPU-accelerated Matrix-Operations. The GPU-Kernel-functions are stored in a registry to optimize initialization timings and to ensure single-initialization.

Further Info for Production Usage

The transpiled Javascript-target is ES6, with a CommonJS module format.

For Contributors

  1. Clone this project to a working directory.
  2. npm install to setup the development dependencies.
  3. To compile the codebase:
tsc -p .

This project relies on Visual Studio Codes built-in Typescript linting facilities. It primarily follows the Google TypeScript Style-Guide through the provided tslint-google.json configuration file.


As of License-File: MIT


npm i recurrent-js-gpu

DownloadsWeekly Downloads






Last publish


  • mvrahden