code: def main(_):
      metagraph = get_metagraph()
      config = config_pb2.ConfigProto()
      if FLAGS.rewriter_config is not None:
          text_format.Merge(
              FLAGS.rewriter_config,
              config.graph_options.rewrite_options,
          )
      optimized_graph = tf_optimizer.OptimizeGraph(config, metagraph)
      metagraph.graph_def.CopyFrom(optimized_graph)
  
      report = cost_analyzer.GenerateCostReport(
          metagraph, FLAGS.per_node_report, FLAGS.verbose
      )
      print(report)
      if FLAGS.memory_report:
          report = cost_analyzer.GenerateMemoryReport(metagraph)
          print(report)
  
file_path: tensorflow-upstream/tensorflow/python/grappler/cost_analyzer_tool.py
imports: import argparse
  import sys
  from absl import app
  from google.protobuf import message
  from google.protobuf import text_format
  from tensorflow.core.framework import graph_pb2
  from tensorflow.core.protobuf import config_pb2
  from tensorflow.core.protobuf import meta_graph_pb2
  from tensorflow.core.protobuf import saved_model_pb2
  from tensorflow.python.framework import importer
  from tensorflow.python.framework import ops
  from tensorflow.python.grappler import cost_analyzer
  from tensorflow.python.grappler import tf_optimizer
  from tensorflow.python.platform import gfile
  from tensorflow.python.training import saver
label_desc: Use image node_id 2 for calling a global function with example usage: main(_) without return types