Clarify user messages.
@@ -85,8 +85,14 @@ def multivariate_normal(x, mu, L):
p[n] = log pdf of:
x[n] ~ N(mu, LL^T) or x ~ N(mu[n], LL^T) or x[n] ~ N(mu[n], LL^T)
"""
- if x.shape.ndims != 2: warnings.warn('Shape of x may be unknown or not 2D.')
- if mu.shape.ndims != 2: warnings.warn('Shape of mu may be unknown or not 2D.')
+ if x.shape.ndims is None:
+ warnings.warn('Shape of x must be 2D at computation.')
+ elif x.shape.ndims != 2:
+ raise ValueError('Shape of x must be 2D.')
+ if mu.shape.ndims is None:
+ warnings.warn('Shape of mu may be unknown or not 2D.')
+ elif x.shape.ndims != 2:
+ raise ValueError('Shape of mu must be 2D.')
d = x - mu
alpha = tf.matrix_triangular_solve(L, d, lower=True)
