TensorFlow.js: Addition RNN in web worker

Train a model in web worker


This example trains a Recurrent Neural Network in web worker to do addition without explicitly defining the addition operator. Instead we feed it examples of sums and let it learn from that.

In this way, we can do long-running computation without actually blocking the UI rendering thread.

Given a string like 3 + 4, it will learn to output a number like 7.

This example generates its own training data programatically.


Click the "Train Model" to start the model training button. You can edit the parameters used to train the model as well.

Training Size:
RNN Type:
RNN Layers:
RNN Hidden Layer Size:
Batch Size:
Train Iterations:
# of test examples:

Training Progress

Test Examples