code: def parse_flags(flags_obj):
      """Convenience function to turn flags into params."""
      num_gpus = flags_core.get_num_gpus(flags_obj)
  
      batch_size = flags_obj.batch_size
      eval_batch_size = (
          flags_obj.eval_batch_size or flags_obj.batch_size
      )
  
      return {
          "train_epochs": flags_obj.train_epochs,
          "batches_per_step": 1,
          "use_seed": flags_obj.seed is not None,
          "batch_size": batch_size,
          "eval_batch_size": eval_batch_size,
          "learning_rate": flags_obj.learning_rate,
          "mf_dim": flags_obj.num_factors,
          "model_layers": [int(layer) for layer in flags_obj.layers],
          "mf_regularization": flags_obj.mf_regularization,
          "mlp_reg_layers": [
              float(reg) for reg in flags_obj.mlp_regularization
          ],
          "num_neg": flags_obj.num_neg,
          "distribution_strategy": flags_obj.distribution_strategy,
          "num_gpus": num_gpus,
          "use_tpu": flags_obj.tpu is not None,
          "tpu": flags_obj.tpu,
          "tpu_zone": flags_obj.tpu_zone,
          "tpu_gcp_project": flags_obj.tpu_gcp_project,
          "beta1": flags_obj.beta1,
          "beta2": flags_obj.beta2,
          "epsilon": flags_obj.epsilon,
          "match_mlperf": flags_obj.ml_perf,
          "use_xla_for_gpu": flags_obj.use_xla_for_gpu,
          "epochs_between_evals": FLAGS.epochs_between_evals,
          "keras_use_ctl": flags_obj.keras_use_ctl,
          "hr_threshold": flags_obj.hr_threshold,
          "stream_files": flags_obj.tpu is not None,
          "train_dataset_path": flags_obj.train_dataset_path,
          "eval_dataset_path": flags_obj.eval_dataset_path,
          "input_meta_data_path": flags_obj.input_meta_data_path,
      }
  
file_path: autodist/examples/benchmark/utils/recommendation/ncf_common.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import json
  import os
  import numpy
  from absl import flags
  from absl import logging
  import tensorflow
  from utils.recommendation import constants
  from utils.recommendation import data_pipeline
  from utils.recommendation import data_preprocessing
  from utils.recommendation import movielens
  from utils.flags import core
  from utils.misc import keras_utils
label_desc: Use image node_id 2 for calling a global function with example usage: parse_flags(flags_obj) and returns: dict