code: def test_dependent_matern_gp(obs_dim):
      dt = 0.5 + torch.rand(1).item()
      gp = DependentMaternGP(
          nu=1.5,
          obs_dim=obs_dim,
          dt=dt,
          length_scale_init=0.5 + torch.rand(obs_dim),
      )
  
      # make sure stationary covariance matrix satisfies the relevant
      # matrix riccati equation
      lengthscale = gp.kernel.length_scale.unsqueeze(-1).unsqueeze(-1)
      F = torch.tensor([[0.0, 1.0], [0.0, 0.0]])
      mask1 = torch.tensor([[0.0, 0.0], [-3.0, 0.0]])
      mask2 = torch.tensor([[0.0, 0.0], [0.0, -math.sqrt(12.0)]])
      F = block_diag_embed(
          F + mask1 / lengthscale.pow(2.0) + mask2 / lengthscale
      )
  
      stat_cov = gp._stationary_covariance()
      wiener_cov = gp._get_wiener_cov()
      wiener_cov *= torch.tensor([[0.0, 0.0], [0.0, 1.0]]).repeat(
          obs_dim, obs_dim
      )
  
      expected_zero = (
          torch.matmul(F, stat_cov)
          + torch.matmul(stat_cov, F.transpose(-1, -2))
          + wiener_cov
      )
      assert_equal(
          expected_zero,
          torch.zeros(gp.full_state_dim, gp.full_state_dim),
      )
  
file_path: pyro/tests/contrib/timeseries/test_gp.py
imports: import math
  import pytest
  import torch
  import pyro
  from pyro.contrib.timeseries import DependentMaternGP, GenericLGSSM, GenericLGSSMWithGPNoiseModel, IndependentMaternGP, LinearlyCoupledMaternGP
  from pyro.ops.tensor_utils import block_diag_embed
  from tests.common import assert_equal
label_desc: Use image node_id 2 for calling a global function with example usage: test_dependent_matern_gp(obs_dim) without return types