code: def normal_normal_posterior(
      prior_mean, prior_stddev, likelihood_stddev, data
  ):
      r"""Returns the posterior mean and variance of a normal-normal model.
  
      Given a normal likelihood and a normal prior on the mean, return the
      posterior mean and variance. In this model, the posterior distribution is
      normally distributed and can be computed easily from a formula.
  
      ```
      p(mu | mu0, sigma0) ~ N(mu0, sigma0)
      p(x | mu, sigma) ~ N(mu, sigma)
      p(mu | x, mu0, sigma0) \proportional p(x | mu, sigma) p(mu | mu0, sigma0)
      = N(mu1, sigma1)
      ```
  
      where:
        * `sigma1 = sqrt( 1 / (1 / sigma0**2 + n / sigma**2))`
        * `mu1 = sigma1 ** 2 * (mu0 / sigma0**2 + n * xbar / sigma**2)
        * `n` is the number of samples.
        * `xbar` is the mean of the data.
  
      For a derivation, see https://www.cs.ubc.ca/~murphyk/Papers/bayesGauss.pdf.
  
      Args:
        prior_mean: `numpy.ndarray` representing mean of the normal prior.
        prior_stddev: `numpy.ndarray` representing standard deviation of the
          normal prior.
        likelihood_stddev: `numpy.ndarray` representing standard deviation of the
          normal likelihood.
        data: `numpy.ndarray` whose first dimension represents the number
          of data points.
      Returns:
        posterior_mean, posterior_variance: `Tensors` representing the
          posterior_mean and posterior_variance under this conjugate model.
      """
  
      num_samples = int(data.shape[0])
      posterior_variance = 1 / (
          1 / prior_stddev**2 + num_samples / likelihood_stddev**2
      )
  
      data_mean = np.mean(data, axis=0)
  
      posterior_mean = posterior_variance * (
          prior_mean / prior_stddev**2
          + num_samples * data_mean / likelihood_stddev**2
      )
  
      return posterior_mean, posterior_variance
  
file_path: probability/tensorflow_probability/python/experimental/mcmc/elliptical_slice_sampler_test.py
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.experimental.mcmc import elliptical_slice_sampler
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.mcmc import sample
label_desc: Use image node_id 1 for calling a global function with example usage: normal_normal_posterior(prior_mean, prior_stddev, likelihood_stddev, data) and returns: posterior_mean,  posterior_variance