github tensorflow/tfjs tfjs-v2.0.0
TensorFlow.js 2.0.0

latest releases: tfjs-v4.19.0, tfjs-v4.19.0-rc.0, tfjs-v4.18.0...
3 years ago

TensorFlow.js 2.0.0 is here! It is available on NPM as well as CDNs that sync from NPM.

It contains a few breaking changes, details of which are listed below, but at a high level these are some of the major changes in this release:

  • The CPU and WebGL backends have moved out of tfjs-core into their own packages. tfjs-backend-cpu and tfjs-backend-webgl.
    • If you are not using the union package (i.e. you use tfjs-core, tfjs-layers, tfjs-converter, tfjs-data directly) you need to import these backends into your application to get the same behavior as before, or you can only import a single backend if that is all you need.
    • If you use the union package (i.e. tfjs), then nothing will need to change in your code as these backends are already included.
    • In some situations (e.g. running certain ops with small tensors) the WebGL backend can optionally fall back to the CPU backend, to keep this behavior, for those not using the union package you should include both the cpu and webgl backend in your application. We are working towards saving you this step in 3.x. If you primarily rely on the WebGL backend, you should test the performance with and without the CPU backend present and make the appropriate decision of what to include.
  • In addition to our ES5 bundles, we are shipping new pre-compiled bundles with ES modules and ES2017 code:
    • tf.min.js & tf.es2017.min.js
    • tf-core.min.js & tf-core.es2017.min.js
    • tf-backend-cpu.min.js & tf-backend-cpu.es2017.min.js
    • tf-backend-webgl.min.js & tf-backend-webgl.es2017.min.js
    • tf-layers.min.js & tf-layers.es2017.min.js
    • tf-converter.min.js & tf-converter.es2017.min.js
    • tf-data.min.js & tf-data.es2017.min.js
  • Our 'module' entry in package.json points to files with ES modules and ES2017 code. These are individual files corresponding to the source code of our libraries. This lays down a path to enable tree shaking and smaller bundles in apps.
    • If you have previously been using the files in the 'dist' subfolder of our NPM package, you may need to adjust your build system to consume them.
  • Functionality that was deprecated in 1.x has been removed.
  • In 2.x we are deprecating all the '*Strict' variants of ops. e.g. divStrict and mulStrict.

Core (1.7.4 ==> 2.0.0)

Features

  • [wasm] Add split, sqrt kernels. (#3183).

Breaking changes

  • Remove deprecated batchnormalization op (#3238).
  • Update packages to compile to ESM modules by default (#3112).
  • move webgl backend out of core (#3056).
  • Move cpu backend out of tfjs-core (#3008).

Bug fixes

  • [[core] Restrict size of conv test output to temporarily fix precision issues in Safari.] (#3187).
  • [[core] Change inputs to matMul test to avoid precision issues in Safari as stopgap.] (#3142).
  • fix nightly error on isMobile (#3139).
  • [webgpu] Fix dilation and add stride 2 filter 3x3 same conv2d… (#2846). Thanks, @axinging.
  • ensure isMobile() does not fail when navigator is not set. [ensure isMobile() does not fail when navigator is not set] (#3075).
  • [core] Fix toPixels memLeak for TensorLike inputs. (#3073).
  • Remove duplicate declaration. ([#3030](https://github.com/
  • use the loadOptions to find the IOHandler (#3286)./pull/3030)).
  • [[core] Restrict size of conv test output to temporarily fix precision issues in Safari.] (#3187).
  • [[core] Change inputs to matMul test to avoid precision issues in Safari as stopgap.] (#3142).
  • [core] Fix toPixels memLeak for TensorLike inputs. (#3073).

Development

  • deprecate strict variants of ops (#3239).
  • Add license to pad3d.ts. [Add license.] (#3027).
  • Modularize max. (#2955).
  • Modularize lrn. [Modularize lrn.] (#3218).
  • Modularize sub. (#3021).
  • Modularize matmul. [Modularize matmul.] (#3223).
  • Modularize diag. [Modularize diag.] (#3217).
  • Modularize conv ops. [[core] Modularize conv ops.] (#3120).
  • Nightly test fixes [Nightly test fixes] (#3208).
  • Modularize greaterEqual. [Modularize greaterEqual.] (#3192).
  • Modularize lessEqual. [Modularize lessEqual.] (#3190).
  • Modularize equal. [Modularize equal.] (#3189).
  • Modularize less. [Modularize less.] (#3188).
  • Fix browserstack iPhone browser issue. [Fix browserstack iPhone browser issue.] (#3204).
  • Modularize greater. [Modularize greater.] (#3191).
  • Modularize concat and split. [[core] Modularize concat and split.] (#3093).
  • Remove use of chained ops. [Remove use of chained ops.] (#3058).
  • Modularize notEqual. [[core]Modularize notEqual.] (#3091).
  • update yarn.lock (#3090).
  • fix nightly test for isMobile. [fix nightly test for isMobile] (#3079).
  • Remove backward func from SquaredDifference. [Clean up. Remove backward func from SquaredDifference.] (#3055).
  • Add this.throwIfDisposed() to modularized ops. [Add this.throwIfDisposed();] (#3044).
  • Modularize depthToSpace. (#3277).
  • Modularize spaceToBatchND. (#3273).
  • Modularize batchToSpaceND. (#3272).

Misc

Data (1.7.4 ==> 2.0.0)

Breaking changes

  • remove deprecated functionality (#3233).
  • Update packages to compile to ESM modules by default (#3112).

Layers (1.7.4 ==> 2.0.0)

Breaking changes

  • Remove deprecated batchnormalization op (#3238).
  • Update packages to compile to ESM modules by default (#3112).
  • move webgl backend out of core (#3056).
  • Move cpu backend out of tfjs-core (#3008).

Converter (1.7.4 ==> 2.0.0)

Features

  • added support select v2 op (#3154).

Breaking changes

  • Update packages to compile to ESM modules by default (#3112).
  • Move cpu backend out of tfjs-core (#3008).

Bug fixes

  • fix tensor array gather not be able to handle indices longer than available tensors (#3157).
  • remove unnecessary eager call (#3145).

Misc

  • Switching to tf.io. for file access and loading savedmodels in eager model. (#3126). Thanks, @davidzats-eng.

Node (1.7.4 ==> 2.0.0)

Features

  • Add support for napi version 6. [Add support for napi version 6] (#3242).

Breaking changes

  • Remove deprecated batchnormalization op (#3238).
  • [node] Remove deprecated createTypeOpAttr (#3235).
  • Update packages to compile to ESM modules by default (#3112).

Bug fixes

  • Fix node and nodegpu build. (#3248).

Development

  • Modularize conv ops. [[core] Modularize conv ops.] (#3120).

Documentation

Misc

  • Remove layers symlink in node-gpu. (#3031).

Wasm (1.7.4 ==> 2.0.0)

Features

  • [wasm] Add split, sqrt kernels. (#3183).
  • use instantiateWasm override and platform fetch (#3100).

Breaking changes

  • Update packages to compile to ESM modules by default (#3112).

Bug fixes

  • [wasm] Enable compatibility with emscripten 1.39.11, which in t… (#3108).

Development

  • Modularize conv ops. [[core] Modularize conv ops.] (#3120).
  • [core] Modularize max. (#2955).

Don't miss a new tfjs release

NewReleases is sending notifications on new releases.