class_docstr: String modules together.
class_docstr_tok: ["String","modules","together","."]
docstr: Constructor.
  
  Args:
    dag: A directed acyclical graph in the form of a list of nodes. Each node
      has the form
  
      ['module', ['input_key', ...], ['output_key', ...]]
  
      'module': Module instance or string name of module. For example,
        'encoder' woud access the attribute `dag_layer.encoder`.
      'input_key': List of strings, nested keys in dictionary of dag outputs.
        For example, 'inputs/f0_hz' would access `outputs[inputs]['f0_hz']`.
        Inputs to the dag are wrapped in a `inputs` dict as shown in the
        example. This list is ordered and has one key per a module input
        argument. Each node's outputs are prefixed by their module name.
      'output_key': List of strings, keys for each return value of the module.
        For example, ['amps', 'freqs'] would have the module return a dict
        {'module_name': {'amps': return_value_0, 'freqs': return_value_1}}.
        If the module returns a dictionary, the keys of the dictionary will be
        used and these values (if provided) will be ignored.
  
      The graph is read sequentially and must be topologically sorted. This
      means that all inputs for a module must already be generated by earlier
      modules (or in the input dictionary).
    **kwarg_modules: A series of modules to add to DAGLayer. Each kwarg that
      is a tf.Module will be added as a property of the layer, so that it will
      be accessible as `dag_layer.kwarg`. Also, other keras kwargs such as
      'name' are split off before adding modules.
docstr_tok: ["Constructor",".","Args",":","dag",":","A","directed","acyclical","graph","in","the","form","of","a","list","of","nodes",".","Each","node","has","the","form","[","'module","'",",","[","'input_key","'",",","...","]",",","[","'output_key","'",",","...","]","]","'module","'",":","Module","instance","or","string","name","of","module",".","For","example",",","'encoder","'","woud","access","the","attribute","`","dag_layer.encoder","`",".","'input_key","'",":","List","of","strings",",","nested","keys","in","dictionary","of","dag","outputs",".","For","example",",","'inputs\/f0_hz","'","would","access","`","outputs","[","inputs","]","[","'f0_hz","'","]","`",".","Inputs","to","the","dag","are","wrapped","in","a","`","inputs","`","dict","as","shown","in","the","example",".","This","list","is","ordered","and","has","one","key","per","a","module","input","argument",".","Each","node","'s","outputs","are","prefixed","by","their","module","name",".","'output_key","'",":","List","of","strings",",","keys","for","each","return","value","of","the","module",".","For","example",",","[","'amps","'",",","'freqs","'","]","would","have","the","module","return","a","dict","{","'module_name","'",":","{","'amps","'",":","return_value_0",",","'freqs","'",":","return_value_1","}","}",".","If","the","module","returns","a","dictionary",",","the","keys","of","the","dictionary","will","be","used","and","these","values","(","if","provided",")","will","be","ignored",".","The","graph","is","read","sequentially","and","must","be","topologically","sorted",".","This","means","that","all","inputs","for","a","module","must","already","be","generated","by","earlier","modules","(","or","in","the","input","dictionary",")",".","*","*","kwarg_modules",":","A","series","of","modules","to","add","to","DAGLayer",".","Each","kwarg","that","is","a","tf.Module","will","be","added","as","a","property","of","the","layer",",","so","that","it","will","be","accessible","as","`","dag_layer.kwarg","`",".","Also",",","other","keras","kwargs","such","as","'name","'","are","split","off","before","adding","modules","."]
code: def __init__(self, dag: DAG, **kwarg_modules):
      """Constructor.
  
      Args:
        dag: A directed acyclical graph in the form of a list of nodes. Each node
          has the form
  
          ['module', ['input_key', ...], ['output_key', ...]]
  
          'module': Module instance or string name of module. For example,
            'encoder' woud access the attribute `dag_layer.encoder`.
          'input_key': List of strings, nested keys in dictionary of dag outputs.
            For example, 'inputs/f0_hz' would access `outputs[inputs]['f0_hz']`.
            Inputs to the dag are wrapped in a `inputs` dict as shown in the
            example. This list is ordered and has one key per a module input
            argument. Each node's outputs are prefixed by their module name.
          'output_key': List of strings, keys for each return value of the module.
            For example, ['amps', 'freqs'] would have the module return a dict
            {'module_name': {'amps': return_value_0, 'freqs': return_value_1}}.
            If the module returns a dictionary, the keys of the dictionary will be
            used and these values (if provided) will be ignored.
  
          The graph is read sequentially and must be topologically sorted. This
          means that all inputs for a module must already be generated by earlier
          modules (or in the input dictionary).
        **kwarg_modules: A series of modules to add to DAGLayer. Each kwarg that
          is a tf.Module will be added as a property of the layer, so that it will
          be accessible as `dag_layer.kwarg`. Also, other keras kwargs such as
          'name' are split off before adding modules.
      """
      keras_kwargs, kwarg_modules = split_keras_kwargs(kwarg_modules)
      super().__init__(**keras_kwargs)
  
      # Create properties/submodules from other kwargs.
      modules = filter_by_value(kwarg_modules, is_module)
  
      # Remove modules from the dag, make properties of dag_layer.
      dag, dag_modules = self.format_dag(dag)
      # DAG is now just strings.
      self.dag = dag
      modules.update(dag_modules)
  
      # Make as propreties of DAGLayer to keep track of variables in checkpoints.
      self.module_names = list(modules.keys())
      for module_name, module in modules.items():
          setattr(self, module_name, module)
  
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 1 to create a new DAGLayer object from inherited base classes: tfkl with example: obj = DAGLayer(dag)