code: def train_and_eval():
      """Train and Evaluate."""
      optimizer = tf.compat.v1.train.AdagradOptimizer(
          learning_rate=FLAGS.learning_rate
      )
  
      estimator = tfr.estimator.make_dnn_ranking_estimator(
          example_feature_columns(),
          FLAGS.hidden_layer_dims,
          context_feature_columns=context_feature_columns(),
          optimizer=optimizer,
          learning_rate=FLAGS.learning_rate,
          loss=FLAGS.loss,
          loss_reduction=tf.compat.v1.losses.Reduction.SUM_OVER_BATCH_SIZE,
          activation_fn=tf.nn.relu,
          dropout=FLAGS.dropout,
          use_batch_norm=True,
          model_dir=FLAGS.model_dir,
      )
  
      hparams = {
          "train_input_pattern": FLAGS.train_input_pattern,
          "eval_input_pattern": FLAGS.eval_input_pattern,
          "learning_rate": FLAGS.learning_rate,
          "train_batch_size": FLAGS.batch_size,
          "eval_batch_size": FLAGS.batch_size,
          "predict_batch_size": FLAGS.batch_size,
          "num_train_steps": FLAGS.num_train_steps,
          "num_eval_steps": FLAGS.num_eval_steps,
          "checkpoint_secs": FLAGS.checkpoint_secs,
          "num_checkpoints": FLAGS.num_checkpoints,
          "loss": FLAGS.loss,
          "list_size": FLAGS.list_size,
          "convert_labels_to_binary": FLAGS.convert_labels_to_binary,
          "listwise_inference": FLAGS.listwise_inference,
          "model_dir": FLAGS.model_dir,
      }
  
      ranking_pipeline = tfr.ext.pipeline.RankingPipeline(
          context_feature_columns(),
          example_feature_columns(),
          hparams,
          estimator=estimator,
          label_feature_name=_LABEL_FEATURE,
          label_feature_type=tf.int64,
      )
  
      ranking_pipeline.train_and_eval()
  
imports: from absl import flags
  import tensorflow
  import tensorflow_ranking
label_desc: Use image node_id 3 for calling a global function with example usage: train_and_eval() without return types