class_docstr: RNN-NADE [2], a NADE parameterized by an RNN.
  
  The NADE's bias parameters are given by the output of the RNN.
  
  [2]: https://arxiv.org/abs/1206.6392
  
  Args:
    rnn_cell: The tf.nn.rnn_cell.RnnCell to use.
    num_dims: The number of binary dimensions for each observation.
    num_hidden: The number of hidden units in the NADE.
class_docstr_tok: ["RNN-NADE","[","2","]",",","a","NADE","parameterized","by","an","RNN",".","The","NADE","'s","bias","parameters","are","given","by","the","output","of","the","RNN",".","[","2","]",":","https",":","\/\/arxiv.org\/abs\/1206.6392","Args",":","rnn_cell",":","The","tf.nn.rnn_cell.RnnCell","to","use",".","num_dims",":","The","number","of","binary","dimensions","for","each","observation",".","num_hidden",":","The","number","of","hidden","units","in","the","NADE","."]
docstr: Computes the state of the RNN-NADE (NADE bias parameters and RNN state).
  
  Args:
    inputs: A batch of sequences to compute the state from, sized
        `[batch_size, max(lengths), num_dims]` or `[batch_size, num_dims]`.
    lengths: The length of each sequence, sized `[batch_size]`.
    initial_state: An RnnNadeStateTuple, the initial state of the RNN-NADE, or
        None if the zero state should be used.
  
  Returns:
    final_state: An RnnNadeStateTuple, the final state of the RNN-NADE.
docstr_tok: ["Computes","the","state","of","the","RNN-NADE","(","NADE","bias","parameters","and","RNN","state",")",".","Args",":","inputs",":","A","batch","of","sequences","to","compute","the","state","from",",","sized","`","[","batch_size",",","max","(","lengths",")",",","num_dims","]","`","or","`","[","batch_size",",","num_dims","]","`",".","lengths",":","The","length","of","each","sequence",",","sized","`","[","batch_size","]","`",".","initial_state",":","An","RnnNadeStateTuple",",","the","initial","state","of","the","RNN-NADE",",","or","None","if","the","zero","state","should","be","used",".","Returns",":","final_state",":","An","RnnNadeStateTuple",",","the","final","state","of","the","RNN-NADE","."]
code: def _get_state(self, inputs, lengths=None, initial_state=None):
      """Computes the state of the RNN-NADE (NADE bias parameters and RNN state).
  
      Args:
        inputs: A batch of sequences to compute the state from, sized
            `[batch_size, max(lengths), num_dims]` or `[batch_size, num_dims]`.
        lengths: The length of each sequence, sized `[batch_size]`.
        initial_state: An RnnNadeStateTuple, the initial state of the RNN-NADE, or
            None if the zero state should be used.
  
      Returns:
        final_state: An RnnNadeStateTuple, the final state of the RNN-NADE.
      """
      batch_size = int(inputs.shape[0])
  
      if lengths is None:
          lengths = tf.tile(tf.shape(inputs)[1:2], [batch_size])
      if initial_state is None:
          initial_rnn_state = self._get_rnn_zero_state(batch_size)
      else:
          initial_rnn_state = initial_state.rnn_state
  
      helper = contrib_seq2seq.TrainingHelper(
          inputs=inputs, sequence_length=lengths
      )
  
      decoder = contrib_seq2seq.BasicDecoder(
          cell=self._rnn_cell,
          helper=helper,
          initial_state=initial_rnn_state,
          output_layer=self._fc_layer,
      )
  
      final_outputs, final_rnn_state = contrib_seq2seq.dynamic_decode(
          decoder
      )[0:2]
  
      # Flatten time dimension.
      final_outputs_flat = (
          magenta.common.flatten_maybe_padded_sequences(
              final_outputs.rnn_output, lengths
          )
      )
  
      b_enc, b_dec = tf.split(
          final_outputs_flat,
          [self._nade.num_hidden, self._nade.num_dims],
          axis=1,
      )
  
      return RnnNadeStateTuple(b_enc, b_dec, final_rnn_state)
  
file_path: magenta/magenta/models/pianoroll_rnn_nade/pianoroll_rnn_nade_graph.py
imports: import collections
  import magenta
  from magenta.common import Nade
  from magenta.contrib import seq2seq
  from magenta.models.shared import events_rnn_graph
  import tensorflow.compat.v1
  import tf_slim
label_desc: Use image node_id 3 for calling the RnnNade obj's underlying member method code with example usage: obj._get_state(inputs, lengths, initial_state) and returns: RnnNadeStateTuple