code: def testSampleUnbiasedScalarBatch(self):
      logits = self._rng.rand(3).astype(np.float32)
      dist = oc.OneHotCategorical(logits=logits, validate_args=True)
      n = int(1e4)
      x = dist.sample(n, seed=test_util.test_seed())
      x = tf.cast(x, dtype=tf.float32)
      sample_mean = tf.reduce_mean(x, axis=0)  # elementwise mean
      x_centered = x - sample_mean
      sample_covariance = (
          tf.matmul(x_centered, x_centered, adjoint_a=True) / n
      )
      [
          x_,
          sample_covariance_,
          actual_mean_,
          actual_covariance_,
      ] = self.evaluate(
          [
              x,
              sample_covariance,
              dist.probs_parameter(),
              dist.covariance(),
          ]
      )
      self.assertAllEqual([3], sample_mean.shape)
      self.assertAllMeansClose(
          x_, actual_mean_, axis=0, atol=0.0, rtol=0.1
      )
      self.assertAllEqual([3, 3], sample_covariance.shape)
      self.assertAllClose(
          actual_covariance_, sample_covariance_, atol=0.0, rtol=0.1
      )
  
imports: import numpy
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import identity
  from tensorflow_probability.python.distributions import kullback_leibler
  from tensorflow_probability.python.distributions import onehot_categorical
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.util import deferred_tensor
label_desc: Use image node_id 18 for calling the OneHotCategoricalTest obj's underlying member method code with example usage: obj.testSampleUnbiasedScalarBatch() without return types