Skip to content

Commit aa33cd1

Browse files
committed
Made sample_shape same across all contexts, thereby resolves pymc-devs#3758
1 parent 4fd56fd commit aa33cd1

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

pymc3/distributions/distribution.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,7 @@ def draw_values(params, point=None, size=None):
690690
"""
691691
# The following check intercepts and redirects calls to
692692
# draw_values in the context of sample_posterior_predictive
693+
size = to_tuple(size)
693694
ppc_sampler = vectorized_ppc.get(None)
694695
if ppc_sampler is not None:
695696
# this is being done inside new, vectorized sample_posterior_predictive

pymc3/tests/test_distributions_random.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1664,6 +1664,10 @@ def test_issue_3758(self):
16641664
for var in "abcd":
16651665
assert not np.isnan(np.std(samples[var]))
16661666

1667+
for var in "bcd":
1668+
std = np.std(samples[var] - samples["a"])
1669+
np.testing.assert_allclose(std, 1, rtol=1e-2)
1670+
16671671
def test_issue_3829(self):
16681672
with pm.Model() as model:
16691673
x = pm.MvNormal("x", mu=np.zeros(5), cov=np.eye(5), shape=(2, 5))

0 commit comments

Comments
 (0)