TensorFlow.js

Vadim Markovtsev, source{d}.

TensorFlow.js

Vadim Markovtsev
source{d}

Intro

JavaScript™ belongs to Oracle

Deep Learning is all about linalg

JavaScript sucks at linalg

JavaScript no more sucks at linalg

JavaScript even has autodiff now

TensorFlow.js

Quick facts

Official features

Run Existing models

API levels 
{
CoreKeras

Core API

Core API

Tensorflow model formats zoo

  1. GraphDef = graph + [variable values - 2GB limit]
  2. Checkpoint = variable values
  3. Summary (aka Tensorboard) = GraphDef + key-value
  4. MetaGraph = GraphDef + tags + i/o + Checkpoint
  5. SavedModel = one or more MetaGraph-s
  6. ModuleDef (aka Hub) = special SavedModel
  7. Keras = hdf5 with arch and weights
  8. 🎉 TensorFlow.js = GraphDef + JSON + sharded weights

Execution modes

Semi-manual memory management

Semi-manual memory management

const y = tf.tidy(() => {
   const one = tf.scalar(1);
   const a = tf.scalar(2);
   const b = a.square();
   console.log('numTensors (in tidy): ' + tf.memory().numTensors);
   return b.add(one);
});
console.log('numTensors (outside tidy): ' + tf.memory().numTensors);
y.print();  // y = 2 ^ 2 + 1
        

TensorBuffer

Keras API

Keras is not tf.keras

Keras API

Live demo 1

Mobilenet

    Live demo 2

    Progressive GAN

    Examples

    github.com/tensorflow/tfjs-examples

    Live demo 3

    Installation for Node.js

    npm install @tensorflow/tfjs @tensorflow/tfjs-node
                              or @tensorflow/tfjs-node-gpu

    ijavascript

    npm install ijavascript-await

    Summary

    Summary

    Thank you

    bit.ly/2OwCKXP