code: def GenerateCostReport(
      metagraph, per_node_report=False, verbose=False, cluster=None
  ):
      """Analyze the cost of each TensorFlow op and node in the provided metagraph.
  
      Args:
        metagraph: A TensorFlow MetaGraphDef.
        per_node_report: by default the report contains stats aggregated on a per op
          type basis, setting per_node_report to True adds results for each
          individual node to the report.
        verbose: Prints out the entire operation proto instead of a summary table.
        cluster: Analyze the costs using the specified cluster, or the local machine
          if no cluster was specified.
  
      Returns:
        A string of cost report.
      """
      if cluster is None:
          cluster = gcluster.Cluster(disable_detailed_stats=False)
  
      return tf_wrap.GenerateCostReport(
          metagraph.SerializeToString(),
          per_node_report,
          verbose,
          cluster.tf_cluster,
      )
  
imports: from tensorflow.python.grappler import _pywrap_cost_analyzer
  from tensorflow.python.grappler import cluster
  from tensorflow.python.grappler import item
label_desc: Use image node_id 1 for calling a global function with example usage: GenerateCostReport(metagraph, per_node_report, verbose, cluster) and returns: tf_wrap