class_docstr: A dilated convnet where each layer has the same number of filters.
class_docstr_tok: ["A","dilated","convnet","where","each","layer","has","the","same","number","of","filters","."]
code: def __init__(
      self,
      input_depth,
      num_layers,
      num_filters,
      num_pitches,  # pylint:disable=unused-argument
      output_depth,
      **kwargs,
  ):
      super().__init__()
      tf.logging.info(
          "model_type=%s, input_depth=%d, output_depth=%d",
          self.key,
          input_depth,
          output_depth,
      )
      kws = """num_dilation_blocks dilate_time_only crop_piece_len
            repeat_last_dilation_level num_pointwise_splits
            interleave_split_every_n_layers"""
      for kw in kws.split():
          assert kw in kwargs
      num_dilation_blocks = kwargs["num_dilation_blocks"]
      assert num_dilation_blocks >= 1
      dilate_time_only = kwargs["dilate_time_only"]
      num_pointwise_splits = kwargs["num_pointwise_splits"]
      interleave_split_every_n_layers = kwargs[
          "interleave_split_every_n_layers"
      ]
  
      def compute_max_dilation_level(length):
          return int(np.ceil(np.log2(length))) - 1
  
      max_time_dilation_level = compute_max_dilation_level(
          kwargs["crop_piece_len"]
      )
      max_pitch_dilation_level = compute_max_dilation_level(num_pitches)
      max_dilation_level = max(
          max_time_dilation_level, max_pitch_dilation_level
      )
      if kwargs["repeat_last_dilation_level"]:
          tf.logging.info(
              "Increasing max dilation level from %s to %s",
              max_dilation_level,
              max_dilation_level + 1,
          )
          max_dilation_level += 1
  
      def determine_dilation_rate(level, max_level):
          dilation_level = min(level, max_level)
          return 2**dilation_level
  
      self.layers = []
  
      def _add(**kwargs):
          self.layers.append(kwargs)
  
      _add(filters=[3, 3, input_depth, num_filters])
      for _ in range(num_dilation_blocks):
          for level in range(max_dilation_level + 1):
              time_dilation_rate = determine_dilation_rate(
                  level, max_time_dilation_level
              )
              pitch_dilation_rate = determine_dilation_rate(
                  level, max_pitch_dilation_level
              )
              if dilate_time_only:
                  layer_dilation_rates = [time_dilation_rate, 1]
              else:
                  layer_dilation_rates = [
                      time_dilation_rate,
                      pitch_dilation_rate,
                  ]
              tf.logging.info(
                  "layer_dilation_rates %r", layer_dilation_rates
              )
              if (
                  len(self.layers)
                  % (interleave_split_every_n_layers + 1)
                  == 0
              ):
                  current_num_pointwise_splits = num_pointwise_splits
              else:
                  current_num_pointwise_splits = 1
              tf.logging.info(
                  "num_split %d", current_num_pointwise_splits
              )
              _add(
                  filters=[3, 3, num_filters, num_filters],
                  dilation_rate=layer_dilation_rates,
                  num_pointwise_splits=current_num_pointwise_splits,
              )
      _add(filters=[2, 2, num_filters, num_filters])
      _add(
          filters=[2, 2, num_filters, output_depth],
          activation=lib_util.identity,
      )
  
      tf.logging.info(
          "num_layers=%d, num_filters=%d", len(self.layers), num_filters
      )
      self.name = "%s-%d-%d" % (self.key, len(self.layers), num_filters)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import itertools
  import os
  from magenta.models.coconet import lib_util
  import numpy
  import six
  import tensorflow.compat.v1
  import yaml
label_desc: Use image node_id 1 to create a new Dilated object from inherited base classes: Architecture with example: obj = Dilated(input_depth, num_layers, num_filters, num_pitches, output_depth)