code: def decode(estimator, hparams, decode_hp):
      """Decode from estimator. Interactive, from file, or from dataset."""
      if FLAGS.decode_interactive:
          if estimator.config.use_tpu:
              raise ValueError("TPU can only decode from dataset.")
          decoding.decode_interactively(
              estimator,
              hparams,
              decode_hp,
              checkpoint_path=FLAGS.checkpoint_path,
          )
      elif FLAGS.decode_from_file:
          decoding.decode_from_file(
              estimator,
              FLAGS.decode_from_file,
              hparams,
              decode_hp,
              FLAGS.decode_to_file,
              checkpoint_path=FLAGS.checkpoint_path,
          )
          if FLAGS.checkpoint_path and FLAGS.keep_timestamp:
              ckpt_time = os.path.getmtime(
                  FLAGS.checkpoint_path + ".index"
              )
              os.utime(FLAGS.decode_to_file, (ckpt_time, ckpt_time))
      else:
          decoding.decode_from_dataset(
              estimator,
              FLAGS.problem,
              hparams,
              decode_hp,
              decode_to_file=FLAGS.decode_to_file,
              dataset_split="test" if FLAGS.eval_use_test_set else None,
              checkpoint_path=FLAGS.checkpoint_path,
          )
  
file_path: tensor2tensor/tensor2tensor/bin/t2t_decoder.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  from tensor2tensor.bin import t2t_trainer
  from tensor2tensor.data_generators import problem
  from tensor2tensor.data_generators import text_encoder
  from tensor2tensor.utils import decoding
  from tensor2tensor.utils import registry
  from tensor2tensor.utils import trainer_lib
  from tensor2tensor.utils import usr_dir
  import tensorflow.compat.v1
  from tensorflow.compat.v1 import estimator
label_desc: Use image node_id 3 for calling a global function with example usage: decode(estimator, hparams, decode_hp) without return types