code: def test_resample(replacement):
      x = torch.empty(10000, 2)
      x[:, 0].normal_(3, 4)
      x[:, 1].normal_(5, 6)
  
      num_samples = 5000
      y = resample(x, num_samples=num_samples, replacement=replacement)
      z = resample(
          x.t(), num_samples=num_samples, dim=1, replacement=replacement
      )
      if not replacement:
          assert_equal(torch.unique(y.reshape(-1)).numel(), y.numel())
          assert_equal(torch.unique(z.reshape(-1)).numel(), z.numel())
      assert_equal(y.shape, torch.Size([num_samples, 2]))
      assert_equal(z.shape, torch.Size([2, num_samples]))
      assert_equal(y.mean(dim=0), torch.tensor([3.0, 5.0]), prec=0.2)
      assert_equal(z.mean(dim=1), torch.tensor([3.0, 5.0]), prec=0.2)
      assert_equal(y.std(dim=0), torch.tensor([4.0, 6.0]), prec=0.2)
      assert_equal(z.std(dim=1), torch.tensor([4.0, 6.0]), prec=0.2)
  
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 1 for calling a global function with example usage: test_resample(replacement) without return types