Unverified Commit cc45303b authored by Brandon T. Willard's avatar Brandon T. Willard Committed by GitHub

Always define the `diverging` variable in sampling generator (#3901)

parent eec70e86
......@@ -912,6 +912,7 @@ def _iter_sample(
for i in range(draws):
stats = None
diverging = False
if i == 0 and hasattr(step, "iter_count"):
step.iter_count = 0
......@@ -927,7 +928,6 @@ def _iter_sample(
point = step.step(point)
diverging = False
if callback is not None:
warns = getattr(step, "warnings", None)
callback(trace=strace, draw=Draw(chain, i == draws, i, i < tune, stats, point, warns))
......@@ -28,6 +28,11 @@ class TestTextSampling:
db = text.Text(self.name)
pm.sample(20, tune=10, init=None, trace=db, cores=2)
def test_supports_sampler_stats_diverging(self):
with pm.Model():
pm.Normal("mu", mu=0, sigma=1, shape=2)
pm.sample(20, tune=10, init=None, trace='text', cores=1)
def teardown_method(self):
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment