To build TensorFlow.js Core API from source, we need to clone the project and prepare the dev environment:
$ git clone https://github.com/tensorflow/tfjs-core.git
$ cd tfjs-core
$ yarn # Installs dependencies.
We use yarn, and if you are adding or removing dependencies you should use yarn
to keep the yarn.lock
file up to date.
We recommend using Visual Studio Code for
development. Make sure to install
TSLint VSCode extension
and the npm clang-format 1.2.2
or later
with the
Clang-Format VSCode extension
for auto-formatting.
Before submitting a pull request, make sure the code passes all the tests and is clean of lint errors:
$ yarn test
$ yarn lint
To run a subset of tests and/or on a specific browser:
$ yarn test --browsers=Chrome --grep='multinomial'
> ...
> Chrome 62.0.3202 (Mac OS X 10.12.6): Executed 28 of 1891 (skipped 1863) SUCCESS (6.914 secs / 0.634 secs)
To run the tests once and exit the karma process (helpful on Windows):
$ yarn test --single-run
To run the tests in an environment that does not have GPU support (such as Chrome Remote Desktop):
$ yarn test --testEnv cpu
Available test environments: cpu, webgl1, webgl2.
$ yarn build-npm
> Stored standalone library at dist/tf-core(.min).js
> Stored also tensorflow-tf-core-VERSION.tgz
To install it locally, run yarn add ./tensorflow-tf-core-VERSION.tgz
.
On Windows, use bash (available through git) to use the scripts above.
Looking to contribute, and don't know where to start? Check out our "stat:contributions welcome" issues.