propelml / propel

Differential Programming in JavaScript.


A Machine Learning Framework for JavaScript.

Linux & Mac Windows

How to run TF examples

$ ./tools/build_binding.js
$ ts-node src/nn_example_main.ts

If you're on Linux and would like to build a CUDA version of Propel set the environmental variable PROPEL_BUILD_GPU=1.

$ PROPEL_BUILD_GPU=1 ./tools/build_binding.js
$ ts-node src/nn_example_main.ts


npm packages are built with ./tools/package.js. Here are links to the various packages:


Check out Propel, including its git submodules.

git clone --recursive

Propel generally bundles its dependencies in the "deps" submodule.

To run the tests:


One unincluded dependency is a chromium binary for running tests. If puppeteer complains that chromium hasn't been downloaded, run:

npm rebuild puppeteer

Most of the tests are run on every pull request, however there are three sets of tests which currently must be run manually:

  1. Check that tests pass on a Linux machine with CUDA. Run this command: PROPEL_BUILD_GPU=1 ./tools/presubmit.js

  2. Check that the WebGL backend works. (Puppeteer headless doesn't support WebGL.) Run this command: PP_TEST_DEBUG=1 ts-node test_browser

  3. Check that the DeepLearn tests run. (These tests also require WebGL) Run this command: PP_TEST_DL=1 ts-node test_browser

Adding An Op

Propel is under heavy development and is missing implementations for many common ops. Here is a rough outline of how to add an op

  1. Add the frontend implementation to api.ts or tensor.ts (depending on if its a method of Tensor or a standalone function)

  2. Add the op's signature to the BackendOps interface in types.ts.

  3. Add the forward and backwards passes to ops.ts.

  4. Finally implement the op for DL and TF in dl.ts and tf.ts respectively.

  5. Add a test demonstrating the desired behavior in api_test.ts. The tensorflow binding can be built using ./tools/build_binding.js and the test can be run by doing ts-node api_test.ts MyTest. The DL test can be run by setting an environmental variable: PROPEL=dl ts-node api_test.ts MyTest

Ещё не оценен