class_docstr: Byte-encodes text.
class_docstr_tok: ["Byte-encodes","text","."]
code: def encode(self, s):
      if not self.additional_tokens:
          return pad_incr(list(bytearray(tf.compat.as_bytes(s))))
  
      # Handle additional tokens
      s = tf.compat.as_text(s)
      ids = []
      for substr in self._additional_tokens_re.split(s):
          if not substr:
              continue
          tok_id = self._additional_token_to_id.get(substr)
          if tok_id is None:
              offset = len(self.additional_tokens)
              tok_ids = [
                  i + offset
                  for i in list(bytearray(tf.compat.as_bytes(substr)))
              ]
          else:
              tok_ids = [tok_id]
          ids.extend(tok_ids)
  
      return pad_incr(ids)
  
imports: from __future__ import unicode_literals
  import abc
  import hashlib
  import json
  import re
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
label_desc: Use image node_id 2 for calling the ByteTextEncoder obj's underlying member method code with example usage: obj.encode(s) and returns: pad_incr, pad_incr