title: TensorFlow.js Stateful SimpleRNN Tensor is disposed
body: <p>I'm Trying to create a stateful RNN model. I can call predict once, then the other calls give me an error: <code>Uncaught Error: Tensor is disposed.</code></p>
  
  <p><a href="https://i.stack.imgur.com/QsUtw.png" rel="nofollow noreferrer">predict error</a> </p>
  
  <p>My model is declared as follows:</p>
  
  <pre class="lang-py prettyprint-override"><code>function createModel() {
    const inputGame = tf.input({
      batchShape: [1, 1, OUTPUT_SHAPE],
      name: 'inputGame',
    });
    const inputPlayer = tf.input({
      batchShape: [1, 1, INPUT_PLAYER],
      name: 'inputPlayer',
    });
    const input = tf.layers
      .concatenate({name: 'concatenate'})
      .apply([inputGame, inputPlayer]);
    const rnn = tf.layers.simpleRNN({
      units: 128,
      activation: 'relu',
      stateful: true,
      kernelInitializer: 'glorotNormal',
      biasInitializer: 'glorotNormal',
      name: 'rnn',
    });
    const dense = tf.layers.dense({
      units: OUTPUT_SHAPE,
      activation: 'sigmoid',
      kernelInitializer: 'glorotNormal',
      biasInitializer: 'glorotNormal',
      name: 'dense',
    });
    const output = dense.apply(rnn.apply(input));
    const model = tf.model({inputs: [inputGame, inputPlayer], outputs: [output]});
    const surface = {name: 'Model Summary', tab: 'Model Inspection'};
    tfvis.show.modelSummary(surface, model);
    return model;
  }
  </code></pre>
  
  <p>Then I call predict every second: </p>
  
  <pre class="lang-py prettyprint-override"><code>const inputGameTensor = tf.tensor(frame);
  const inputPlayerTensor = tf.zeros([1, 1, INPUT_PLAYER]);
  const output = model.predict([inputGameTensor, inputPlayerTensor], true);
  </code></pre>
  
  <p>I suspect that there is a <code>state</code> tensor inside the <code>SimpleRNN</code> layer and it is <code>disposed()</code> after calling predict once. I don't know TensorFlow.js well enough to investigate this hypothesis.</p>
  
  <p>I have the code running at:
  <a href="https://luxedo.github.io/TGNN/" rel="nofollow noreferrer">https://luxedo.github.io/TGNN/</a></p>