(self, sequences, lengths=None)
return self._nade.log_prob(labels_flat, state.b_enc, state.b_dec)
Computes the log probability of a sequence of values.

    Flattens the time dimension.

    Args:
      sequences: A batch of sequences to compute the log probabilities of,
          sized `[batch_size, max(lengths), num_dims]`.
      lengths: The length of each sequence, sized `[batch_size]` or None if
          all are equal.

    Returns:
      log_prob: The log probability of each sequence value, sized
          `[sum(lengths), 1]`.
      cond_prob: The conditional probabilities at each non-padded value for
          every batch, sized `[sum(lengths), num_dims]`.
Computes the log probability of a sequence of values.
Computes the log probability of a sequence of values .
def log_prob(self, sequences, lengths=None):
    """Computes the log probability of a sequence of values.

    Flattens the time dimension.

    Args:
      sequences: A batch of sequences to compute the log probabilities of,
          sized `[batch_size, max(lengths), num_dims]`.
      lengths: The length of each sequence, sized `[batch_size]` or None if
          all are equal.

    Returns:
      log_prob: The log probability of each sequence value, sized
          `[sum(lengths), 1]`.
      cond_prob: The conditional probabilities at each non-padded value for
          every batch, sized `[sum(lengths), num_dims]`.
    """
    assert self._num_dims == int(sequences.shape[2])

    # Remove last value from input sequences.
    inputs = sequences[:, 0:-1, :]

    # Add initial padding value to input sequences.
    inputs = tf.pad(inputs, [[0, 0], [1, 0], [0, 0]])

    state = self._get_state(inputs, lengths=lengths)

    # Flatten time dimension.
    labels_flat = magenta.common.flatten_maybe_padded_sequences(
        sequences, lengths)

    return self._nade.log_prob(labels_flat, state.b_enc, state.b_dec)
def log_prob ( self , sequences , lengths = None ) : assert self . _num_dims == int ( sequences . shape [ 2 ] ) # Remove last value from input sequences. inputs = sequences [ : , 0 : - 1 , : ] # Add initial padding value to input sequences. inputs = tf . pad ( inputs , [ [ 0 , 0 ] , [ 1 , 0 ] , [ 0 , 0 ] ] ) state = self . _get_state ( inputs , lengths = lengths ) # Flatten time dimension. labels_flat = magenta . common . flatten_maybe_padded_sequences ( sequences , lengths ) return self . _nade . log_prob ( labels_flat , state . b_enc , state . b_dec )