code: def run_postdecode_hooks(decode_hook_args, dataset_split):
      """Run hooks after decodes have run."""
      hooks = decode_hook_args.problem.decode_hooks
      if not hooks:
          return
      global_step = latest_checkpoint_step(
          decode_hook_args.estimator.model_dir
      )
      if global_step is None:
          tf.logging.info(
              "Skipping decode hooks because no checkpoint yet available."
          )
          return
      tf.logging.info("Running decode hooks.")
      parent_dir = os.path.join(
          decode_hook_args.output_dirs[0], os.pardir
      )
      child_dir = decode_hook_args.decode_hparams.summaries_log_dir
      if dataset_split is not None:
          child_dir += "_{}".format(dataset_split)
      final_dir = os.path.join(parent_dir, child_dir)
      summary_writer = tf.summary.FileWriter(final_dir)
  
      for hook in hooks:
          # Isolate each hook in case it creates TF ops
          with tf.Graph().as_default():
              summaries = hook(decode_hook_args)
          if summaries:
              summary = tf.Summary(value=list(summaries))
              summary_writer.add_summary(summary, global_step)
      summary_writer.close()
      tf.logging.info("Decode hooks done.")
  
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 21 for calling a global function with example usage: run_postdecode_hooks(decode_hook_args, dataset_split) without return types