code: def test_waic():
      x = -torch.arange(1.0, 101).log().reshape(25, 4)
      w_pw, p_pw = waic(x, pointwise=True)
      w, p = waic(x)
      w1, p1 = waic(x.t(), dim=1)
  
      # test against loo package: http://mc-stan.org/loo/reference/waic.html
      assert_equal(
          w_pw, torch.tensor([7.49, 7.75, 7.86, 7.92]), prec=0.01
      )
      assert_equal(
          p_pw, torch.tensor([1.14, 0.91, 0.79, 0.70]), prec=0.01
      )
  
      assert_equal(w, w_pw.sum())
      assert_equal(p, p_pw.sum())
  
      assert_equal(w, w1)
      assert_equal(p, p1)
  
imports: import warnings
  import pytest
  import torch
  from pyro.ops.stats import _cummin, autocorrelation, autocovariance, crps_empirical, effective_sample_size, fit_generalized_pareto, gelman_rubin, hpdi, pi, quantile, resample, split_gelman_rubin, waic
  from tests.common import assert_close, assert_equal, xfail_if_not_implemented
label_desc: Use image node_id 19 for calling a global function with example usage: test_waic() without return types