code: def testStddevShapeUnivariate(self):
      num_components = 2
      # This is the same shape test which is done in 'testMeanUnivariate'.
      for batch_shape in ((), (2,), (2, 3)):
          dist = make_univariate_mixture(
              batch_shape=batch_shape, num_components=num_components
          )
          dev = dist.stddev()
          self.assertEqual(batch_shape, dev.shape)
  
          cat_probs = tf.math.softmax(dist.cat.logits)
          dist_devs = [d.stddev() for d in dist.components]
          dist_means = [d.mean() for d in dist.components]
  
          res = self.evaluate([dev, cat_probs, dist_devs, dist_means])
          (
              dev_value,
              cat_probs_values,
              dist_devs_values,
              dist_means_values,
          ) = res
          # Manual computation of stddev.
          batch_shape_res = cat_probs_values.shape[:-1]
          event_shape_res = dist_devs_values[0].shape[
              len(batch_shape_res) :
          ]
          stacked_mean_res = np.stack(dist_means_values, -1)
          stacked_dev_res = np.stack(dist_devs_values, -1)
  
          # Broadcast cat probs over event dimensions.
          for _ in range(len(event_shape_res)):
              cat_probs_values = np.expand_dims(
                  cat_probs_values, len(batch_shape)
              )
          cat_probs_values = cat_probs_values + np.zeros_like(
              stacked_dev_res
          )
  
          # Perform stddev computation on a flattened batch.
          flat_batch_manual_dev = _mixture_stddev_np(
              np.reshape(cat_probs_values, [-1, num_components]),
              np.reshape(stacked_mean_res, [-1, num_components]),
              np.reshape(stacked_dev_res, [-1, num_components]),
          )
  
          # Reshape to full shape.
          full_shape_res = list(batch_shape_res) + list(event_shape_res)
          manual_dev = np.reshape(flat_batch_manual_dev, full_shape_res)
          self.assertEqual(batch_shape, dev_value.shape)
          self.assertAllClose(manual_dev, dev_value)
  
imports: import contextlib
  import warnings
  import numpy
  from scipy import stats
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import categorical
  from tensorflow_probability.python.distributions import dirichlet
  from tensorflow_probability.python.distributions import distribution
  from tensorflow_probability.python.distributions import gamma
  from tensorflow_probability.python.distributions import half_normal
  from tensorflow_probability.python.distributions import independent
  from tensorflow_probability.python.distributions import mixture
  from tensorflow_probability.python.distributions import mvn_diag
  from tensorflow_probability.python.distributions import mvn_tril
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.internal import hypothesis_testlib
  from tensorflow_probability.python.internal import reparameterization
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.internal import test_util
label_desc: Use image node_id 8 for calling the MixtureTest obj's underlying member method code with example usage: obj.testStddevShapeUnivariate() without return types