1.0.0
TensorFlow.js 1.0
TensorFlow.js 1.0 has been released!
With this release, we are aiming to have API stability guarantees and performance wins. For the most part, the breaking changes listed here are minor and should be relatively simple to migrate to new APIs.
Performance
TensorFlow.js 1.0 brings major performance gains on common machine learning models. Here is a graph of the performance gains of TensorFlow.js 1.0 versus last year in June 2018:
Features
- Tensor.array() and Tensor.arraySync() have been added. These are similar to
Tensor.data()
but return deeply nested arrays with the same logical shape as the originaltf.Tensor
.
Breaking changes
- Graphs converted from TensorFlow now generate JSON graphs (
model.json
). Any protocol buffer graphs with the extension.pb
are now deprecated. You can convert.pb
graphs to.json
graphs with thepb2json
NPM script in the tensorflow/tfjs-converter repository. tf.loadModel
is deleted. Please use tf.loadLayersModel instead.tf.loadFrozenModel
is deleted. Please use tf.loadGraphModel instead.tf.Model
has been renamedtf.LayersModel
.tf.FrozenModel
has been renamedtf.GraphModel
.- When converting models with the tensorflowjs pip package, use
--output_format
stringstfjs_layers_model
andtfjs_graph_model
instead andtensorflowjs
. Tensor.get
is deleted. Please use Tensor.array and native array indexing instead.Tensor.buffer
is now async (returns a Promise). If you need the sync version, please use Tensor.bufferSync.tf.fromPixels
is deleted. Please use tf.browser.fromPixels instead.tf.toPixels
is deleted. Please use tf.browser.toPixels instead.tf.batchNormalization
is deprecated. Please use tf.batchNorm. Note the positional change of the arguments.Dataset.forEach
is deleted. Please useDataSet.forEachAsync
instead.LayersModel.fitDataset
now only accepts {xs, ys} as a dictionary mapping 'xs' and 'ys' to their respective Tensor values. The [xs, ys] tuple format is now removed.tf.io.browserHTTPRequest
now takes two arguments, a url and an options object. See the new API here.tf.data.generator()
now takes a generatorfunction*
, instead of an iterator. See API doc.