def dirichlet_entropy_vec(alpha):
 if (len(alpha.shape) == 1):
  return stats.dirichlet.entropy(alpha)
 else:
  n_minibatch = alpha.shape[0]
  return np.array([stats.dirichlet.entropy(alpha[i, :]) for i in range(n_minibatch)])

def dirichlet_entropy_vec ( alpha ) : if ( len ( alpha . shape ) == 1 ) : return stats . dirichlet . entropy ( alpha ) else : n_minibatch = alpha . shape [ 0 ] return np . array ( [ stats . dirichlet . entropy ( alpha [ i , : ] ) for i in range ( n_minibatch ) ] )
vectorized version of stats .