q, p = q0, p0
q, p, _ = step.leapfrog(q, p, floatX(np.array(epsilon)), np.array(n_steps, dtype="int32"))
q, p, _ = step.leapfrog(q, -p, floatX(np.array(epsilon)), np.array(n_steps, dtype="int32"))
close_to(q, q0, precision, str((n_steps, epsilon)))
close_to(-p, p0, precision, str((n_steps, epsilon)))
@pytest.mark.xfail(condition=(theano.config.floatX == "float32"), reason="Fails on float32")
After Change
for n_steps in [1, 2, 3, 4, 20]:
state = start
for _ in range(n_steps):
state = step.integrator.step(epsilon, state)
for _ in range(n_steps):
state = step.integrator.step(-epsilon, state)
close_to(state.q, start.q, precision, str((n_steps, epsilon)))
close_to(state.p, start.p, precision, str((n_steps, epsilon)))