Skip to content

Commit 1e13cf9

Browse files
Yield stats from _iter_sample
1 parent d61ddf6 commit 1e13cf9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pymc/sampling/mcmc.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,22 +1293,25 @@ def _iter_sample(
12931293
step.iter_count = 0
12941294
if i == tune:
12951295
step.stop_tuning()
1296+
12961297
point, stats = step.step(point)
12971298
trace.record(point, stats)
12981299
log_warning_stats(stats)
1299-
diverging = i > tune and len(stats) > 0 and (stats[0].get("diverging") is True)
1300+
13001301
if callback is not None:
13011302
callback(
13021303
trace=trace,
13031304
draw=Draw(chain, i == draws, i, i < tune, stats, point),
13041305
)
13051306

1306-
yield diverging
1307+
yield stats
1308+
13071309
except (KeyboardInterrupt, BaseException):
13081310
if isinstance(trace, ZarrChain):
13091311
trace.record_sampling_state(step=step)
13101312
trace.close()
13111313
raise
1314+
13121315
else:
13131316
if isinstance(trace, ZarrChain):
13141317
trace.record_sampling_state(step=step)

0 commit comments

Comments
 (0)