class_docstr: Wrapper around tensor2tensor SubwordTextEncoder.
  
  1 is already reserved for EOS - no need to shift.
class_docstr_tok: ["Wrapper","around","tensor2tensor","SubwordTextEncoder",".","1","is","already","reserved","for","EOS","-","no","need","to","shift","."]
docstr: Encode a tf.Scalar string to a tf.Tensor.
  
  This will be necessary for on-the-fly tokenization.
  
  Args:
    s: a tf.Scalar with dtype tf.string
  Returns:
    a 1d tf.Tensor with dtype tf.int32
docstr_tok: ["Encode","a","tf.Scalar","string","to","a","tf.Tensor",".","This","will","be","necessary","for","on-the-fly","tokenization",".","Args",":","s",":","a","tf.Scalar","with","dtype","tf.string","Returns",":","a","1d","tf.Tensor","with","dtype","tf.int32"]
code: def encode_tf(self, s):
      """Encode a tf.Scalar string to a tf.Tensor.
  
      This will be necessary for on-the-fly tokenization.
  
      Args:
        s: a tf.Scalar with dtype tf.string
      Returns:
        a 1d tf.Tensor with dtype tf.int32
      """
      ids = self._subword_text_encoder_encode(s, self._filepath)
      # the c++ op apppends 1=EOS - drop it.
      return ids[:-1]
  
file_path: mesh/mesh_tensorflow/transformer/t2t_vocabulary.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import gin
  from mesh_tensorflow.transformer import vocabulary
label_desc: Use image node_id 5 for calling the T2tVocabulary obj's underlying member method code with example usage: obj.encode_tf(s) and returns: ids