class_docstr: RNN and FC stacks for f0 and loudness.
class_docstr_tok: ["RNN","and","FC","stacks","for","f0","and","loudness","."]
docstr: Constructor.
  
  Args:
    rnn_channels: Dims for the RNN layer.
    rnn_type: Either 'gru' or 'lstm'.
    ch: Dims of the fully connected layers.
    layers_per_stack: Fully connected layers per a stack.
    stateless: Change api to explicitly pass in and out RNN state. Needed for
      SavedModel/TFLite inference. Uses nn.StatelessRnn.
    input_keys: Create a fully connected stack for each input.
    output_splits: Splits the outputs into these dimensions.
    **kwargs: Keras-specific kwargs.
  
  Returns:
    Dictionary with keys from output_splits. Also has 'state' key if
      `stateless=True`, for manually handling state.
docstr_tok: ["Constructor",".","Args",":","rnn_channels",":","Dims","for","the","RNN","layer",".","rnn_type",":","Either","'gru","'","or","'lstm","'",".","ch",":","Dims","of","the","fully","connected","layers",".","layers_per_stack",":","Fully","connected","layers","per","a","stack",".","stateless",":","Change","api","to","explicitly","pass","in","and","out","RNN","state",".","Needed","for","SavedModel\/TFLite","inference",".","Uses","nn.StatelessRnn",".","input_keys",":","Create","a","fully","connected","stack","for","each","input",".","output_splits",":","Splits","the","outputs","into","these","dimensions",".","*","*","kwargs",":","Keras-specific","kwargs",".","Returns",":","Dictionary","with","keys","from","output_splits",".","Also","has","'state","'","key","if","`","stateless=True","`",",","for","manually","handling","state","."]
code: def __init__(
      self,
      rnn_channels=512,
      rnn_type="gru",
      ch=512,
      layers_per_stack=3,
      stateless=False,
      input_keys=("ld_scaled", "f0_scaled", "z"),
      output_splits=(("amps", 1), ("harmonic_distribution", 40)),
      **kwargs,
  ):
      """Constructor.
  
      Args:
        rnn_channels: Dims for the RNN layer.
        rnn_type: Either 'gru' or 'lstm'.
        ch: Dims of the fully connected layers.
        layers_per_stack: Fully connected layers per a stack.
        stateless: Change api to explicitly pass in and out RNN state. Needed for
          SavedModel/TFLite inference. Uses nn.StatelessRnn.
        input_keys: Create a fully connected stack for each input.
        output_splits: Splits the outputs into these dimensions.
        **kwargs: Keras-specific kwargs.
  
      Returns:
        Dictionary with keys from output_splits. Also has 'state' key if
          `stateless=True`, for manually handling state.
      """
      # Manually handle state if stateless.
      self.stateless = stateless
  
      # Always put state as the last input and output.
      self.output_splits = output_splits
      output_keys = [v[0] for v in output_splits]
      if self.stateless:
          input_keys = list(input_keys) + ["state"]
          output_keys = list(output_keys) + ["state"]
  
      super().__init__(
          input_keys=input_keys, output_keys=output_keys, **kwargs
      )
  
      # Don't create a stack for manual RNN state.
      stack = lambda: nn.FcStack(ch, layers_per_stack)
      n_stacks = len(self.input_keys)
      if self.stateless:
          n_stacks -= 1
      rnn_cls = nn.StatelessRnn if stateless else nn.Rnn
  
      # Layers.
      self.input_stacks = [stack() for _ in range(n_stacks)]
      self.rnn = rnn_cls(rnn_channels, rnn_type)
      self.out_stack = stack()
  
      # Copied from OutputSplitsLayer to handle stateless logic.
      n_out = sum([v[1] for v in output_splits])
      self.dense_out = tfkl.Dense(n_out)
  
imports: from ddsp import core
  from ddsp.training import nn
  import gin
  import tensorflow
label_desc: Use image node_id 1 to create a new RnnFcDecoder object from inherited base classes: nn with example: obj = RnnFcDecoder(rnn_channels, rnn_type, ch, layers_per_stack, stateless, input_keys, output_splits)