code: def main(unused_argv):
      tf.set_random_seed(2191997)
      np.random.seed(6281996)
  
      logging.info("=> Starting ...")
  
      # Select dataset.
      logging.info("=> Preparing datasets ...")
      data = datasets.get_dataset(FLAGS.dataset, "train", FLAGS)
      batch = tf.data.make_one_shot_iterator(data).get_next()
  
      # Select model.
      logging.info("=> Creating {} model".format(FLAGS.model))
      model = models.get_model(FLAGS.model, FLAGS)
      optimizer = tf.train.AdamOptimizer(FLAGS.lr)
  
      # Set up the graph
      train_loss, train_op, global_step = model.compute_loss(
          batch, training=True, optimizer=optimizer
      )
  
      # Training hooks
      stop_hook = tf.train.StopAtStepHook(last_step=FLAGS.max_steps)
      summary_writer = tf.summary.FileWriter(FLAGS.train_dir)
      ops = tf.get_collection(tf.GraphKeys.SUMMARIES)
      summary_hook = tf.train.SummarySaverHook(
          save_steps=100, summary_writer=summary_writer, summary_op=ops
      )
      step_counter_hook = tf.train.StepCounterHook(
          summary_writer=summary_writer
      )
      hooks = [stop_hook, step_counter_hook, summary_hook]
  
      logging.info("=> Start training loop ...")
      with tf.train.MonitoredTrainingSession(
          checkpoint_dir=FLAGS.train_dir,
          hooks=hooks,
          scaffold=None,
          save_checkpoint_steps=FLAGS.save_every,
          save_checkpoint_secs=None,
          save_summaries_steps=None,
          save_summaries_secs=None,
          log_step_count_steps=None,
          max_wait_secs=3600,
      ) as mon_sess:
          while not mon_sess.should_stop():
              mon_sess.run([batch, train_loss, global_step, train_op])
  
file_path: graphics/tensorflow_graphics/projects/cvxnet/train.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  import tensorflow.compat.v1
  from tensorflow_graphics.projects.cvxnet.lib import datasets
  from tensorflow_graphics.projects.cvxnet.lib import models
  from tensorflow_graphics.projects.cvxnet.lib import utils
label_desc: Use image node_id 1 for calling a global function with example usage: main(unused_argv) without return types