code: def main(unused_argv):
      del unused_argv
  
      for _, name, cls in goldens.list_goldens():
          if not re.match(FLAGS.filter, name):
              continue
  
          checkpoint_dir = os.path.join(FLAGS.golden_dir, name)
          exists = os.path.exists(checkpoint_dir)
          if exists and not FLAGS.regenerate:
              logging.info(
                  "Skipping %s since it exists and --regenerate=false",
                  name,
              )
              continue
  
          logging.info("Processing %s", name)
          if not exists:
              safe_mkdir(checkpoint_dir)
          else:
              # Clear out old files.
              for file_name in os.listdir(checkpoint_dir):
                  safe_unlink(os.path.join(checkpoint_dir, file_name))
  
          # Create the module to checkpoint.
          golden = cls()
          module = golden.create_module()
          golden.create_all_variables(module)
          for var in module.variables:
              var.assign(goldens.range_like(var))
  
          # Create a checkpoint and save the values to it.
          checkpoint = tf.train.Checkpoint(module=module)
          if FLAGS.dry_run:
              logging.warning(
                  "[DRY RUN] Would save %r to %r",
                  module,
                  checkpoint_dir,
              )
          else:
              file_prefix = os.path.join(checkpoint_dir, "checkpoint")
              logging.info("Saving to checkpoint %s.", file_prefix)
              checkpoint.save(file_prefix=file_prefix)
  
file_path: sonnet/sonnet/src/conformance/checkpoints/generate.py
imports: import os
  import re
  from absl import app
  from absl import flags
  from absl import logging
  from sonnet.src.conformance import goldens
  import tensorflow
label_desc: Use image node_id 3 for calling a global function with example usage: main(unused_argv) without return types