decode(x, calcArgmax = true) {
    return tf.tidy(() => {
      if (calcArgmax) {
        x = x.argMax(1);
      }
      const xData = x.dataSync();  // TODO(cais): Performance implication?
      let output = '';
      for (const index of Array.from(xData)) {
        output += this.indicesChar[index];
      }
      return output;
    });
  }
Convert a 2D tensor into a string with the CharacterTable's vocabulary.

@param x Input 2D tensor.
@param calcArgmax Whether to perform `argMax` operation on `x` before
  indexing into the `CharacterTable`'s vocabulary.
@returns The decoded string.