Skip to content

Commit 4a5ba0f

Browse files
committed
Used np.swapaxes to take transpose
1 parent c33d571 commit 4a5ba0f

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

pymc3/distributions/multivariate.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1646,9 +1646,7 @@ def random(self, point=None, size=None):
16461646
rowchol = np.broadcast_to(rowchol, shape=size + rowchol.shape[-2:])
16471647

16481648
colchol = np.broadcast_to(colchol, shape=size + colchol.shape[-2:])
1649-
perm = np.arange(len(output_shape))
1650-
perm[-2:] = [perm[-1], perm[-2]]
1651-
colchol = np.transpose(colchol, perm)
1649+
colchol = np.swapaxes(colchol, -1, -2) # Take transpose
16521650

16531651
standard_normal = np.random.standard_normal(output_shape)
16541652
samples = mu + np.matmul(rowchol, np.matmul(standard_normal, colchol))

0 commit comments

Comments
 (0)