code: def test_can_step_dynamics_faster_than_observations(self):
      initial_state_prior = jdn.JointDistributionNamed(
          {
              "position": deterministic.Deterministic(1.0),
              "velocity": deterministic.Deterministic(0.0),
          }
      )
  
      # Use 100 steps between observations to integrate a simple harmonic
      # oscillator.
      dt = 0.01
  
      def simple_harmonic_motion_transition_fn(_, state):
          return jdn.JointDistributionNamed(
              {
                  "position": normal.Normal(
                      loc=state["position"] + dt * state["velocity"],
                      scale=dt * 0.01,
                  ),
                  "velocity": normal.Normal(
                      loc=state["velocity"] - dt * state["position"],
                      scale=dt * 0.01,
                  ),
              }
          )
  
      def observe_position(_, state):
          return normal.Normal(loc=state["position"], scale=0.01)
  
      particles, _, _, lps = self.evaluate(
          particle_filter.particle_filter(
              # 'Observing' the values we'd expect from a proper integrator should
              # give high likelihood if our discrete approximation is good.
              observations=tf.convert_to_tensor(
                  [tf.math.cos(0.0), tf.math.cos(1.0)]
              ),
              initial_state_prior=initial_state_prior,
              transition_fn=simple_harmonic_motion_transition_fn,
              observation_fn=observe_position,
              num_particles=1024,
              num_transitions_per_observation=100,
              seed=test_util.test_seed(),
          )
      )
  
      self.assertLen(particles["position"], 101)
      self.assertAllClose(
          np.mean(particles["position"], axis=-1),
          tf.math.cos(dt * np.arange(101)),
          atol=0.04,
      )
      self.assertLen(lps, 101)
      self.assertGreater(lps[0], 3.0)
      self.assertGreater(lps[-1], 3.0)
  
imports: import functools
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import shift
  from tensorflow_probability.python.distributions import bernoulli
  from tensorflow_probability.python.distributions import deterministic
  from tensorflow_probability.python.distributions import joint_distribution_auto_batched
  from tensorflow_probability.python.distributions import joint_distribution_named
  from tensorflow_probability.python.distributions import linear_gaussian_ssm
  from tensorflow_probability.python.distributions import mvn_diag
  from tensorflow_probability.python.distributions import mvn_tril
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.distributions import poisson
  from tensorflow_probability.python.distributions import sample
  from tensorflow_probability.python.distributions import transformed_distribution
  from tensorflow_probability.python.distributions import uniform
  from tensorflow_probability.python.experimental.mcmc import particle_filter
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.math import gradient
label_desc: Use image node_id 9 for calling the _ParticleFilterTest obj's underlying member method code with example usage: obj.test_can_step_dynamics_faster_than_observations() and returns: jdn, normal