code: def write_gin_config(summary_writer, save_dir, step):
      """ "Writes gin operative_config to save_dir and tensorboard."""
      config_str = gin.operative_config_str()
  
      # Save the original config string to a file.
      base_name = "operative_config-{}".format(step)
      fname = os.path.join(save_dir, base_name + ".gin")
      with tf.io.gfile.GFile(fname, "w") as f:
          f.write(config_str)
  
      # Formatting hack copied from gin.tf.GinConfigSaverHook.
      def format_for_tensorboard(line):
          """Convert a single line to markdown format."""
          if not line.startswith("#"):
              return "    " + line
          line = line[2:]
          if line.startswith("===="):
              return ""
          if line.startswith("None"):
              return "    # None."
          if line.endswith(":"):
              return "#### " + line
          return line
  
      # Convert config string to markdown.
      md_lines = []
      for line in config_str.splitlines():
          md_line = format_for_tensorboard(line)
          if md_line is not None:
              md_lines.append(md_line)
      md_config_str = "\n".join(md_lines)
  
      # Add to tensorboard.
      with summary_writer.as_default():
          text_tensor = tf.convert_to_tensor(md_config_str)
          tf.summary.text(
              name="gin/" + base_name, data=text_tensor, step=step
          )
          summary_writer.flush()
  
file_path: ddsp/ddsp/training/train_util.py
imports: import json
  import os
  import time
  from absl import logging
  from ddsp.training import cloud
  import gin
  import tensorflow.compat.v2
label_desc: Use image node_id 6 for calling a global function with example usage: write_gin_config(summary_writer, save_dir, step) and returns: line, unknown, str, str, unknown