class_docstr: String modules together.
class_docstr_tok: ["String","modules","together","."]
docstr: Remove modules from dag, and replace with module names.
docstr_tok: ["Remove","modules","from","dag",",","and","replace","with","module","names","."]
code: def format_dag(dag):
      """Remove modules from dag, and replace with module names."""
      modules = {}
      dag = list(dag)  # Make mutable in case it's a tuple.
      for i, node in enumerate(dag):
          node = list(node)  # Make mutable in case it's a tuple.
          module = node[0]
          if is_module(module):
              # Strip module from the dag.
              modules[module.name] = module
              # Replace with module name.
              node[0] = module.name
          dag[i] = node
      return dag, modules
  
file_path: ddsp/ddsp/dags.py
imports: from typing import Dict, Sequence, Tuple, Text, TypeVar
  from absl import logging
  from ddsp import core
  import gin
  import tensorflow.compat.v2
label_desc: Use image node_id 3 for calling the DAGLayer obj's underlying member method code with example usage: obj.format_dag(dag) and returns: dag,  modules