code: def test_statistics_B_ok_with_sample_shape(statistics, sample_shape):
      xs = torch.rand((10,) + torch.Size(sample_shape))
      with xfail_if_not_implemented():
          y = statistics(xs)
  
      # test correct shape
      assert_equal(y.shape, xs.shape)
  
      # test correct batch calculation
      batch_statistics = []
      for x in xs.reshape(10, -1).split(1, dim=1):
          batch_statistics.append(statistics(x))
      assert_equal(
          torch.cat(batch_statistics, dim=1).reshape(xs.shape), y
      )
  
      # test dim=-1
      if statistics is not _cummin:
          a = xs.transpose(0, -1)
          assert_equal(statistics(a, dim=-1), y.transpose(0, -1))
  
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 14 for calling a global function with example usage: test_statistics_B_ok_with_sample_shape(statistics, sample_shape) without return types