code: def test_sample(concentration, rate, n_samples=int(1e6)):
      samples = InverseGamma(concentration, rate).sample((n_samples,))
      mean, std = samples.mean().item(), samples.std().item()
      expected_mean = rate / (concentration - 1.0)
      expected_std = rate / (
          (concentration - 1.0) * math.sqrt(concentration - 2.0)
      )
      assert_equal(mean, expected_mean, prec=1e-2)
      assert_equal(std, expected_std, prec=0.03)
  
imports: import math
  import pytest
  import torch
  from pyro.distributions import Gamma, InverseGamma
  from tests.common import assert_equal
label_desc: Use image node_id 1 for calling a global function with example usage: test_sample(concentration, rate, n_samples) without return types