class_docstr: Simple leapfrog integrator.
  
  Calling this functor is conceptually equivalent to:
  
  ```none
  def leapfrog(x, v, eps, L, f, M):
    g = lambda x: gradient(f, x)
    v[0] = v + eps/2 g(x)
    for l = 1...L:
      x[l] = x[l-1] + eps * inv(M) @ v[l-1]
      v[l] = v[l-1] + eps * g(x[l])
    v = v[L] - eps/2 * g(x[L])
    return x[L], v
  ```
  
  where `M = eye(dims(x))`.
  (In the future we may support arbitrary covariance `M`.)
  
  #### Examples:
  
  ```python
  import matplotlib.pyplot as plt
  import tensorflow.compat.v2 as tf
  import tensorflow_probability as tfp
  from tensorflow_probability.python.mcmc.internal import leapfrog_integrator as leapfrog_impl
  dims = 10
  dtype = tf.float32
  
  target_fn = tfp.distributions.MultivariateNormalDiag(
      loc=tf.zeros(dims, dtype)).log_prob
  
  integrator = leapfrog_impl.SimpleLeapfrogIntegrator(
      target_fn,
      step_sizes=[0.1],
      num_steps=3)
  
  momentum = [tf.random.normal([dims], dtype=dtype)]
  position = [tf.random.normal([dims], dtype=dtype)]
  target = None
  target_grad_parts = None
  
  num_iter = int(1e3)
  positions = tf.zeros([num_iter, dims], dtype)
  for i in range(num_iter):
    [momentum, position, target, target_grad_parts] = integrator(
        momentum, position, target, target_grad_parts)
    positions = tf.tensor_scatter_nd_update(positions, [[i]], position)
  
  plt.plot(positions[:, 0]);  # Sinusoidal.
  ```
class_docstr_tok: ["Simple","leapfrog","integrator",".","Calling","this","functor","is","conceptually","equivalent","to",":","``","`","none","def","leapfrog","(","x",",","v",",","eps",",","L",",","f",",","M",")",":","g","=","lambda","x",":","gradient","(","f",",","x",")","v","[","0","]","=","v","+","eps\/2","g","(","x",")","for","l","=","1","...","L",":","x","[","l","]","=","x","[","l-1","]","+","eps","*","inv","(","M",")","@","v","[","l-1","]","v","[","l","]","=","v","[","l-1","]","+","eps","*","g","(","x","[","l","]",")","v","=","v","[","L","]","-","eps\/2","*","g","(","x","[","L","]",")","return","x","[","L","]",",","v","``","`","where","`","M","=","eye","(","dims","(","x",")",")","`",".","(","In","the","future","we","may","support","arbitrary","covariance","`","M","`",".",")","#","#","#","#","Examples",":","``","`","python","import","matplotlib.pyplot","as","plt","import","tensorflow.compat.v2","as","tf","import","tensorflow_probability","as","tfp","from","tensorflow_probability.python.mcmc.internal","import","leapfrog_integrator","as","leapfrog_impl","dims","=","10","dtype","=","tf.float32","target_fn","=","tfp.distributions.MultivariateNormalDiag","(","loc=tf.zeros","(","dims",",","dtype",")",")",".log_prob","integrator","=","leapfrog_impl.SimpleLeapfrogIntegrator","(","target_fn",",","step_sizes=","[","0.1","]",",","num_steps=3",")","momentum","=","[","tf.random.normal","(","[","dims","]",",","dtype=dtype",")","]","position","=","[","tf.random.normal","(","[","dims","]",",","dtype=dtype",")","]","target","=","None","target_grad_parts","=","None","num_iter","=","int","(","1e3",")","positions","=","tf.zeros","(","[","num_iter",",","dims","]",",","dtype",")","for","i","in","range","(","num_iter",")",":","[","momentum",",","position",",","target",",","target_grad_parts","]","=","integrator","(","momentum",",","position",",","target",",","target_grad_parts",")","positions","=","tf.tensor_scatter_nd_update","(","positions",",","[","[","i","]","]",",","position",")","plt.plot","(","positions","[",":",",","0","]",")",";","#","Sinusoidal",".","``","`"]
code: def step_sizes(self):
      return self._step_sizes
  
file_path: probability/tensorflow_probability/python/mcmc/internal/leapfrog_integrator.py
imports: import abc
  import six
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.mcmc.internal import util
label_desc: Use image node_id 3 for calling the SimpleLeapfrogIntegrator obj's underlying member method code with example usage: obj.step_sizes() and returns: self