code: def define_keras_flags(dynamic_loss_scale=True):
      """Define flags for Keras models."""
      flags_core.define_base(
          clean=True,
          num_gpu=True,
          run_eagerly=True,
          train_epochs=True,
          epochs_between_evals=True,
          distribution_strategy=True,
      )
      flags_core.define_performance(
          num_parallel_calls=False,
          synthetic_data=True,
          dtype=True,
          all_reduce_alg=True,
          num_packs=True,
          tf_gpu_thread_mode=True,
          datasets_num_private_threads=True,
          dynamic_loss_scale=dynamic_loss_scale,
          loss_scale=True,
          fp16_implementation=True,
          tf_data_experimental_slack=True,
          enable_xla=True,
          force_v2_in_keras_compile=True,
          training_dataset_cache=True,
      )
      flags_core.define_image()
      flags_core.define_benchmark()
      flags_core.define_distribution()
      flags.adopt_module_key_flags(flags_core)
  
      flags.DEFINE_boolean(
          name="enable_eager", default=False, help="Enable eager?"
      )
      flags.DEFINE_boolean(
          name="skip_eval", default=False, help="Skip evaluation?"
      )
      # TODO(b/135607288): Remove this flag once we understand the root cause of
      # slowdown when setting the learning phase in Keras backend.
      flags.DEFINE_boolean(
          name="set_learning_phase_to_train",
          default=True,
          help="If skip eval, also set Keras learning phase to 1 (training).",
      )
      flags.DEFINE_boolean(
          name="explicit_gpu_placement",
          default=False,
          help="If not using distribution strategy, explicitly set device scope "
          "for the Keras training loop.",
      )
      flags.DEFINE_boolean(
          name="use_trivial_model",
          default=False,
          help="Whether to use a trivial Keras model.",
      )
      flags.DEFINE_boolean(
          name="report_accuracy_metrics",
          default=True,
          help="Report metrics during training and evaluation.",
      )
      flags.DEFINE_boolean(
          name="use_tensor_lr",
          default=False,
          help="Use learning rate tensor instead of a callback.",
      )
      flags.DEFINE_boolean(
          name="enable_tensorboard",
          default=False,
          help="Whether to enable Tensorboard callback.",
      )
      flags.DEFINE_integer(
          name="train_steps",
          default=None,
          help="The number of steps to run for training. If it is larger than "
          "# batches per epoch, then use # batches per epoch. This flag will be "
          "ignored if train_epochs is set to be larger than 1. ",
      )
      flags.DEFINE_string(
          name="profile_steps",
          default=None,
          help="Save profiling data to model dir at given range of global steps. The "
          "value must be a comma separated pair of positive integers, specifying "
          'the first and last step to profile. For example, "--profile_steps=2,4" '
          "triggers the profiler to process 3 steps, starting from the 2nd step. "
          "Note that profiler has a non-trivial performance overhead, and the "
          "output file can be gigantic if profiling many steps.",
      )
      flags.DEFINE_boolean(
          name="batchnorm_spatial_persistent",
          default=True,
          help="Enable the spacial persistent mode for CuDNN batch norm kernel.",
      )
      flags.DEFINE_boolean(
          name="enable_get_next_as_optional",
          default=False,
          help="Enable get_next_as_optional behavior in DistributedIterator.",
      )
      flags.DEFINE_boolean(
          name="enable_checkpoint_and_export",
          default=False,
          help="Whether to enable a checkpoint callback and export the savedmodel.",
      )
      flags.DEFINE_string(
          name="tpu", default="", help="TPU address to connect to."
      )
      flags.DEFINE_integer(
          name="steps_per_loop",
          default=1,
          help="Number of steps per graph-mode loop. Only training step happens "
          "inside the loop. Callbacks will not be called inside. Will be capped at "
          "steps per epoch.",
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  from absl import flags
  import numpy
  import tensorflow
  from tensorflow.python.keras.optimizer_v2 import gradient_descent
  from utils.flags import core
  from utils.misc import keras_utils
label_desc: Use image node_id 5 for calling a global function with example usage: define_keras_flags(dynamic_loss_scale) without return types