code: def testHalfCauchySampleMedian(self):
      batch_size = 2
      loc_ = 3.0
      scale_ = 1.0
      loc = self._create_placeholder_with_default(
          [loc_] * batch_size, name="loc"
      )
      scale = self._create_placeholder_with_default(
          scale_, name="scale"
      )
      n = int(1e5)
      dist = half_cauchy.HalfCauchy(
          loc=loc, scale=scale, validate_args=True
      )
      samples = dist.sample(n, seed=test_util.test_seed())
      sample_values = self.evaluate(samples)
  
      self.assertEqual(sample_values.shape, (n, batch_size))
      self.assertAllClose(
          np.median(sample_values),
          stats.halfcauchy.median(loc_, scale_),
          atol=0.0,
          rtol=1e-2,
      )
  
      expected_shape = tf.TensorShape([n]).concatenate(
          tf.TensorShape(self.evaluate(dist.batch_shape_tensor()))
      )
      self.assertAllEqual(expected_shape, sample_values.shape)
  
      expected_shape = tf.TensorShape([n]).concatenate(dist.batch_shape)
      self.assertEqual(expected_shape, samples.shape)
  
imports: import numpy
  from scipy import stats
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import half_cauchy
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.math import gradient
label_desc: Use image node_id 22 for calling the _HalfCauchyTest obj's underlying member method code with example usage: obj.testHalfCauchySampleMedian() without return types