code: def test_conditional(Xnew, X, kernel, f_loc, f_scale_tril, loc, cov):
      loc0, cov0 = conditional(
          Xnew, X, kernel, f_loc, f_scale_tril, full_cov=True
      )
      loc1, var1 = conditional(
          Xnew, X, kernel, f_loc, f_scale_tril, full_cov=False
      )
  
      if loc is not None:
          assert_equal(loc0, loc)
          assert_equal(loc1, loc)
      n = cov0.shape[-1]
      var0 = torch.stack(
          [mat.diag() for mat in cov0.view(-1, n, n)]
      ).reshape(cov0.shape[:-1])
      assert_equal(var0, var1)
      if cov is not None:
          assert_equal(cov0, cov)
  
file_path: pyro/tests/contrib/gp/test_conditional.py
imports: from collections import namedtuple
  import pytest
  import torch
  import pyro
  from pyro.contrib.gp.kernels import Matern52, WhiteNoise
  from pyro.contrib.gp.util import conditional
  from tests.common import assert_equal
label_desc: Use image node_id 1 for calling a global function with example usage: test_conditional(Xnew, X, kernel, f_loc, f_scale_tril, loc, cov) without return types