code: def testGammaSampleMultiDimensional(self):
      n_concentration = 50
      concentration_v = np.array(
          [np.arange(1, n_concentration + 1, dtype=np.float32)]
      )  # 1 x 50
      n_rate = 10
      rate_v = np.array(
          [np.arange(1, n_rate + 1, dtype=np.float32)]
      ).T  # 10 x 1
      gamma = gamma_lib.Gamma(
          concentration=concentration_v, rate=rate_v, validate_args=True
      )
  
      n = 10000
  
      samples = gamma.sample(n, seed=test_util.test_seed())
      sample_values = self.evaluate(samples)
  
      self.assertEqual(samples.shape, (n, n_rate, n_concentration))
      self.assertEqual(
          sample_values.shape, (n, n_rate, n_concentration)
      )
      zeros = np.zeros_like(concentration_v + rate_v)  # 10 x 100
      concentration_bc = concentration_v + zeros
      rate_bc = rate_v + zeros
      self.assertAllClose(
          sample_values.mean(axis=0),
          sp_stats.gamma.mean(concentration_bc, scale=1 / rate_bc),
          atol=0.0,
          rtol=0.05,
      )
      self.assertAllClose(
          sample_values.var(axis=0),
          sp_stats.gamma.var(concentration_bc, scale=1 / rate_bc),
          atol=10.0,
          rtol=0.0,
      )
      fails = 0
      trials = 0
      for ai, a in enumerate(np.reshape(concentration_v, [-1])):
          for bi, b in enumerate(np.reshape(rate_v, [-1])):
              s = sample_values[:, bi, ai]
              trials += 1
              fails += 0 if self._kstest(a, b, s) else 1
      self.assertLess(fails, trials * 0.03)
  
imports: import functools
  from absl.testing import parameterized
  import numpy
  from scipy import misc
  from scipy import special
  from scipy import stats
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import exp
  from tensorflow_probability.python.distributions import gamma
  from tensorflow_probability.python.distributions import kullback_leibler
  from tensorflow_probability.python.distributions.internal import statistical_testing
  from tensorflow_probability.python.internal import implementation_selection
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.math import gradient
label_desc: Use image node_id 23 for calling the GammaTest obj's underlying member method code with example usage: obj.testGammaSampleMultiDimensional() without return types