(logmix, mean, logstd, y, batch_mask, dont_reduce_loss)
return -tf.reduce_mean(tf.reduce_sum(v, axis=3))
Computes MDN loss term for svg decoder model.
Computes MDN loss term for svg decoder model.
Computes MDN loss term for svg decoder model .
def _get_mdn_loss(logmix, mean, logstd, y, batch_mask, dont_reduce_loss):
  """Computes MDN loss term for svg decoder model."""
  logsqrttwopi = np.log(np.sqrt(2.0 * np.pi))

  v = logmix + _tf_lognormal(y, mean, logstd, logsqrttwopi)
  v = tf.reduce_logsumexp(v, 1, keepdims=True)
  v = tf.reshape(v, [-1, 51, 1, 6])

  # mask out unimportant terms given the ground truth commands
  v = tf.multiply(v, batch_mask)
  if dont_reduce_loss:
    return -tf.reduce_mean(tf.reduce_sum(v, axis=3), [1, 2])
  return -tf.reduce_mean(tf.reduce_sum(v, axis=3))
def _get_mdn_loss ( logmix , mean , logstd , y , batch_mask , dont_reduce_loss ) : logsqrttwopi = np . log ( np . sqrt ( 2.0 * np . pi ) ) v = logmix + _tf_lognormal ( y , mean , logstd , logsqrttwopi ) v = tf . reduce_logsumexp ( v , 1 , keepdims = True ) v = tf . reshape ( v , [ - 1 , 51 , 1 , 6 ] ) # mask out unimportant terms given the ground truth commands v = tf . multiply ( v , batch_mask ) if dont_reduce_loss : return - tf . reduce_mean ( tf . reduce_sum ( v , axis = 3 ) , [ 1 , 2 ] ) return - tf . reduce_mean ( tf . reduce_sum ( v , axis = 3 ) )