docstr: Tests if layer builds properly and produces outputs of correct shape.
docstr_tok: ["Tests","if","layer","builds","properly","and","produces","outputs","of","correct","shape","."]
code: def test_build_layer(self, kwarg_modules):
      """Tests if layer builds properly and produces outputs of correct shape."""
      gin_config = (
          self.gin_config_kwarg_modules
          if kwarg_modules
          else self.gin_config_dag_modules
      )
      with gin.unlock_config():
          gin.clear_config()
          gin.parse_config(gin_config)
  
      dag_layer = ConfigurableDAGLayer()
      outputs = dag_layer(self.inputs)
      self.assertIsInstance(outputs, dict)
  
      z = outputs["bottleneck"]["z_bottleneck"]
      x_rec = outputs["decoder"]["reconstruction"]
      x_rec2 = outputs["out"]["reconstruction"]
  
      # Confirm that layer generates correctly sized tensors.
      self.assertEqual(outputs["test_data"].shape, self.x.shape)
      self.assertEqual(
          outputs["inputs"]["test_data"].shape, self.x.shape
      )
      self.assertEqual(x_rec.shape, self.x.shape)
      self.assertEqual(z.shape[-1], self.z_dims)
      self.assertAllClose(x_rec, x_rec2)
  
      # Confirm that variables are inherited by DAGLayer.
      self.assertLen(dag_layer.trainable_variables, 6)
  
file_path: ddsp/ddsp/dags_test.py
imports: from absl.testing import parameterized
  from ddsp import dags
  import gin
  import tensorflow
label_desc: Use image node_id 2 for calling the DAGLayerTest obj's underlying member method code with example usage: obj.test_build_layer(kwarg_modules) without return types