import tensorflow as tf

  for i in range(n_iters):
    loss, samples = step_fn(dynamics, optimizer, samples)
    if verbose:
      print("Iteration %d: loss %.4f" % (i, loss))

    if logdir:
      with summary_writer.as_default():
        with tf.contrib.summary.always_record_summaries():
          tf.contrib.summary.scalar("loss", loss)


class L2hmcTest(tf.test.TestCase):
  """Unit tests for l2hmc in both eager and graph mode."""

  def test_apply_transition(self):
    """Testing function `Dynamics.apply_transition` in graph and eager mode."""
