class_docstr: Abstract class for encoding strings as lists of integers.
  
  We will subclass this and wrap multiple implementations of text encoders.
  We follow the convention that ids 0=PAD and 1=EOS are reserved.
class_docstr_tok: ["Abstract","class","for","encoding","strings","as","lists","of","integers",".","We","will","subclass","this","and","wrap","multiple","implementations","of","text","encoders",".","We","follow","the","convention","that","ids","0=PAD","and","1=EOS","are","reserved","."]
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
      """
      raise NotImplementedError("Not implemented.")
  
file_path: mesh/mesh_tensorflow/transformer/vocabulary.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import gin
  import tensorflow_datasets
label_desc: Use image node_id 4 for calling the Vocabulary obj's underlying member method code with example usage: obj.encode_tf(s) without return types