From be8e11b249abcc620ed67d41e470d9047e1a43ff Mon Sep 17 00:00:00 2001 From: Junpeng Lao Date: Fri, 3 Feb 2017 15:26:25 +0100 Subject: [PATCH] Bug fixed for LKJCorr --- pymc3/distributions/multivariate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pymc3/distributions/multivariate.py b/pymc3/distributions/multivariate.py index 546aad0130..57ae197460 100755 --- a/pymc3/distributions/multivariate.py +++ b/pymc3/distributions/multivariate.py @@ -569,8 +569,6 @@ class LKJCorr(Continuous): """ def __init__(self, n, p, *args, **kwargs): - self.n = n = tt.as_tensor_variable(n) - self.p = p = tt.as_tensor_variable(p) n_elem = int(p * (p - 1) / 2) self.mean = np.zeros(n_elem) super(LKJCorr, self).__init__(shape=n_elem, *args, **kwargs) @@ -579,6 +577,8 @@ def __init__(self, n, p, *args, **kwargs): self.tri_index[np.triu_indices(p, k=1)] = np.arange(n_elem) self.tri_index[np.triu_indices(p, k=1)[::-1]] = np.arange(n_elem) + self.n = n = tt.as_tensor_variable(n) + self.p = p = tt.as_tensor_variable(p) def _normalizing_constant(self, n, p): if n == 1: result = gammaln(2. * tt.arange(1, int((p - 1) / 2) + 1)).sum()