code: def test_hpdi():
      x = torch.randn(20000)
      assert_equal(hpdi(x, prob=0.8), pi(x, prob=0.8), prec=0.01)
  
      x = torch.empty(20000).exponential_(1)
      assert_equal(
          hpdi(x, prob=0.2), torch.tensor([0.0, 0.22]), prec=0.01
      )
  
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 4 for calling a global function with example usage: test_hpdi() without return types