def test_can_pull_summaries_out_of_scan_in_append_mode(self):

    def f(x):

        def body(x, _):
            summary.summary(x, name='x', mode='append')
            return ((x + 1), ())
        return lax.scan(body, x, jnp.arange(10.0))[0]
    (value, summaries) = summary.get_summaries(f)(0.0)
    self.assertEqual(value, 10.0)
    np.testing.assert_allclose(summaries['x'], np.arange(10.0))
def test_can_pull_summaries_out_of_scan_in_append_mode(self):

    def f(x):

        def body(x, _):
            summary.summary(x, name='x', mode='append')
            return ((x + 1), ())
        return lax.scan(body, x, jnp.arange(10.0))[0]
    (value, summaries) = summary.get_summaries(f)(0.0)
    self.assertEqual(value, 10.0)
    np.testing.assert_allclose(summaries['x'], np.arange(10.0))