code: def tokens_to_bytes(tokens):
      """Given a sequence of strings, map to sequence of bytes.
  
      Args:
        tokens: A tf.string tensor
  
      Returns:
        A tensor of shape words.shape + [bytes_per_word] containing byte versions
        of each word.
      """
      bytes_per_word = DEFAULT_CHAR_MAXLEN
      with tf.device("/cpu:0"):
          tf.assert_rank(tokens, 1)
          shape = tf.shape(tokens)
          tf.logging.info(tokens)
          tokens_flat = tf.reshape(tokens, [-1])
          as_bytes_flat = tf.map_fn(
              fn=lambda x: _string_to_bytes(
                  x, max_length=bytes_per_word
              ),
              elems=tokens_flat,
              dtype=tf.int32,
              back_prop=False,
          )
          tf.logging.info(as_bytes_flat)
          as_bytes = tf.reshape(
              as_bytes_flat, [shape[0], bytes_per_word]
          )
      return as_bytes
  
file_path: nlp-architect/examples/sparse_gnmt/gnmt/utils/vocab_utils.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import codecs
  import os
  import tensorflow
  from tensorflow.python.ops import lookup_ops
  from .None import misc_utils
label_desc: Use image node_id 2 for calling a global function with example usage: tokens_to_bytes(tokens) and returns: as_bytes