ravens/models/mdn_utils.py
def pick_max_mean(pi, mu, var):
  """Prediction as the mean of the most-weighted gaussian.

  Args are all TF:
    pi: (batch_size, num_gaussians)
    mu: (batch_size, num_gaussians * d_out)
    var: (batch_size, num_gaussians)
  Returns:
    (batch_size, d_out) NUMPY
  """
  mu = tf.reshape(mu, (tf.shape(mu)[0], tf.shape(pi)[1], -1))
  d_out = tf.shape(mu)[-1]
  batch_size, k = pi.shape
  prediction = np.zeros((batch_size, d_out))
  argmax_pi = tf.argmax(pi, axis=1) # shape (batch_size)
  for i in range(batch_size):
    ith_argmax_pi = argmax_pi[i].numpy()
    prediction[i] = mu[i, ith_argmax_pi]
  return prediction
Prediction as the mean of the most-weighted gaussian.

  Args are all TF:
    pi: (batch_size, num_gaussians)
    mu: (batch_size, num_gaussians * d_out)
    var: (batch_size, num_gaussians)
  Returns:
    (batch_size, d_out) NUMPY
  
Prediction as the mean of the most-weighted gaussian.
Prediction as the mean of the most - weighted gaussian .
def pick_max_mean(pi, mu, var):
  mu = tf.reshape(mu, (tf.shape(mu)[0], tf.shape(pi)[1], -1))
  d_out = tf.shape(mu)[-1]
  batch_size, k = pi.shape
  prediction = np.zeros((batch_size, d_out))
  argmax_pi = tf.argmax(pi, axis=1) 
  for i in range(batch_size):
    ith_argmax_pi = argmax_pi[i].numpy()
    prediction[i] = mu[i, ith_argmax_pi]
  return prediction
def pick_max_mean ( pi , mu , var ) : mu = tf . reshape ( mu , ( tf . shape ( mu ) [ 0 ] , tf . shape ( pi ) [ 1 ] , - 1 ) ) d_out = tf . shape ( mu ) [ - 1 ] batch_size , k = pi . shape prediction = np . zeros ( ( batch_size , d_out ) ) argmax_pi = tf . argmax ( pi , axis = 1 ) for i in range ( batch_size ) : ith_argmax_pi = argmax_pi [ i ] . numpy ( ) prediction [ i ] = mu [ i , ith_argmax_pi ] return prediction
Prediction as the mean of the most-weighted gaussian.
Prediction as the mean of the most - weighted gaussian .
"""Prediction as the mean of the most-weighted gaussian.

  Args are all TF:
    pi: (batch_size, num_gaussians)
    mu: (batch_size, num_gaussians * d_out)
    var: (batch_size, num_gaussians)
  Returns:
    (batch_size, d_out) NUMPY
  """ # shape (batch_size)
(batch_size, d_out) NUMPY
( batch_size d_out ) NUMPY
pi
mu
var