code: def test_standard_gamma_elbo(alpha):
      num_samples = 100000
      alphas = torch.full((num_samples, 1), alpha).requires_grad_()
      betas = torch.ones(num_samples, 1)
  
      model = Gamma(torch.ones(num_samples, 1), betas)
      guide1 = Gamma(alphas, betas)
      guide2 = RejectionStandardGamma(
          alphas
      )  # implemented using Rejector
  
      grads = []
      for guide in [guide1, guide2]:
          grads.append(
              compute_elbo_grad(model, guide, [alphas])[0].data
          )
      expected, actual = grads
      assert_equal(
          actual.mean(),
          expected.mean(),
          prec=0.01,
          msg="bad grad for alpha",
      )
  
file_path: pyro/tests/distributions/test_rejector.py
imports: import pytest
  import torch
  from torch.autograd import grad
  from pyro.distributions import Exponential, Gamma
  from pyro.distributions.testing.rejection_exponential import RejectionExponential
  from pyro.distributions.testing.rejection_gamma import RejectionGamma, RejectionStandardGamma, ShapeAugmentedBeta, ShapeAugmentedGamma
  from tests.common import assert_equal
label_desc: Use image node_id 6 for calling a global function with example usage: test_standard_gamma_elbo(alpha) without return types