code: def _save_until_eos(ids, skip=False):
      """Strips everything after the first <EOS> token, which is normally 1."""
      ids = ids.flatten()
      if skip:
          return ids
      try:
          index = list(ids).index(text_encoder.EOS_ID)
          return ids[0:index]
      except ValueError:
          # No EOS_ID: return the array as-is.
          return ids
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  import operator
  import os
  import re
  import string
  import time
  import numpy
  import six
  from six.moves import input
  from tensor2tensor.data_generators import problem
  from tensor2tensor.data_generators import text_encoder
  from tensor2tensor.data_generators import text_problems
  from tensor2tensor.utils import contrib
  from tensor2tensor.utils import hparam
  from tensor2tensor.utils import mlperf_log
  from tensor2tensor.utils import registry
  import tensorflow.compat.v1
  from tensorflow.compat.v1 import estimator
label_desc: Use image node_id 16 for calling a global function with example usage: _save_until_eos(ids, skip) and returns: ids, ids, ids