code: def test_NcpDiscrete():
      framerate = 100  # Hz
      dt = 1.0 / framerate
      d = 3
      ncp = NcpDiscrete(dimension=d, sv2=2.0)
      assert ncp.dimension == d
      assert ncp.dimension_pv == 2 * d
      assert ncp.num_process_noise_parameters == 1
  
      x = torch.rand(d)
      y = ncp(x, dt)
      assert_equal(y, x)
  
      dx = ncp.geodesic_difference(x, y)
      assert_equal(dx, torch.zeros(d))
  
      x_pv = ncp.mean2pv(x)
      assert len(x_pv) == 6
      assert_equal(x, x_pv[:d])
      assert_equal(torch.zeros(d), x_pv[d:])
  
      P = torch.eye(d)
      P_pv = ncp.cov2pv(P)
      assert P_pv.shape == (2 * d, 2 * d)
      P_pv_ref = torch.zeros((2 * d, 2 * d))
      P_pv_ref[:d, :d] = P
      assert_equal(P_pv_ref, P_pv)
  
      Q = ncp.process_noise_cov(dt)
      Q1 = ncp.process_noise_cov(dt)  # Test caching.
      assert_equal(Q, Q1)
      assert Q1.shape == (d, d)
      assert_cov_validity(Q1)
  
      dx = ncp.process_noise_dist(dt).sample()
      assert dx.shape == (ncp.dimension,)
  
file_path: pyro/tests/contrib/tracking/test_dynamic_models.py
imports: import torch
  from pyro.contrib.tracking.dynamic_models import NcpContinuous, NcpDiscrete, NcvContinuous, NcvDiscrete
  from tests.common import assert_equal, assert_not_equal
label_desc: Use image node_id 4 for calling a global function with example usage: test_NcpDiscrete() without return types