(self, lls, x, pxhat, t, d)
Update accumulated log-likelihoods.

    Note: the shape of `lls` and the range of `d` depends on the "number of
    variables per time step" `dd`, which is the number of instruments if
    instruments if instruments are separated or the number of pitches otherwise.

    Args:
      lls: (tt, dd)-shaped array of unit log-likelihoods.
      x: the pianoroll being evaluated, shape (B, tt, P, I).
      pxhat: the probabilities output by the model, shape (B, tt, P, I).
      t: the batch of time indices being evaluated, shape (B,).
      d: the batch of variable indices being evaluated, shape (B,).
Update accumulated log-likelihoods.
Update accumulated log - likelihoods .
def _update_lls(self, lls, x, pxhat, t, d):
    """Update accumulated log-likelihoods.

    Note: the shape of `lls` and the range of `d` depends on the "number of
    variables per time step" `dd`, which is the number of instruments if
    instruments if instruments are separated or the number of pitches otherwise.

    Args:
      lls: (tt, dd)-shaped array of unit log-likelihoods.
      x: the pianoroll being evaluated, shape (B, tt, P, I).
      pxhat: the probabilities output by the model, shape (B, tt, P, I).
      t: the batch of time indices being evaluated, shape (B,).
      d: the batch of variable indices being evaluated, shape (B,).
    """
    # The code below assumes x is binary, so instead of x * log(px) which is
    # inconveniently NaN if both x and log(px) are zero, we can use
    # where(x, log(px), 0).
    assert np.array_equal(x, x.astype(bool))
    if self.separate_instruments:
      index = (np.arange(x.shape[0]), t, slice(None), d)
    else:
      index = (np.arange(x.shape[0]), t, d, slice(None))
    lls[t, d] = np.log(np.where(x[index], pxhat[index], 1)).sum(axis=1)
def _update_lls ( self , lls , x , pxhat , t , d ) : # The code below assumes x is binary, so instead of x * log(px) which is # inconveniently NaN if both x and log(px) are zero, we can use # where(x, log(px), 0). assert np . array_equal ( x , x . astype ( bool ) ) if self . separate_instruments : index = ( np . arange ( x . shape [ 0 ] ) , t , slice ( None ) , d ) else : index = ( np . arange ( x . shape [ 0 ] ) , t , d , slice ( None ) ) lls [ t , d ] = np . log ( np . where ( x [ index ] , pxhat [ index ] , 1 ) ) . sum ( axis = 1 )