code: def test_expand(
      extra_shape,
      log_normalizer_shape,
      info_vec_shape,
      precision_shape,
      alpha_shape,
      beta_shape,
      dim,
  ):
      rank = dim + dim
      log_normalizer = torch.randn(log_normalizer_shape)
      info_vec = torch.randn(info_vec_shape + (dim,))
      precision = torch.randn(precision_shape + (dim, rank))
      precision = precision.matmul(precision.transpose(-1, -2))
      alpha = torch.randn(alpha_shape).exp()
      beta = torch.randn(beta_shape).exp()
      gamma_gaussian = GammaGaussian(
          log_normalizer, info_vec, precision, alpha, beta
      )
  
      expected_shape = extra_shape + broadcast_shape(
          log_normalizer_shape,
          info_vec_shape,
          precision_shape,
          alpha_shape,
          beta_shape,
      )
      actual = gamma_gaussian.expand(expected_shape)
      assert actual.batch_shape == expected_shape
  
imports: import math
  import pytest
  import torch
  from torch.nn.functional import pad
  import pyro.distributions
  from pyro.distributions.util import broadcast_shape
  from pyro.ops.gamma_gaussian import GammaGaussian, gamma_and_mvn_to_gamma_gaussian, gamma_gaussian_tensordot, matrix_and_mvn_to_gamma_gaussian
  from tests.common import assert_close
  from tests.ops.gamma_gaussian import assert_close_gamma_gaussian, random_gamma, random_gamma_gaussian
  from tests.ops.gaussian import random_mvn
label_desc: Use image node_id 1 for calling a global function with example usage: test_expand(extra_shape, log_normalizer_shape, info_vec_shape, precision_shape, alpha_shape, beta_shape, dim) without return types