code: def test_elbo_enumerate_1(scale):
      pyro.param(
          "guide_probs_x",
          torch.tensor([0.1, 0.9]),
          constraint=constraints.simplex,
      )
      pyro.param(
          "model_probs_x",
          torch.tensor([0.4, 0.6]),
          constraint=constraints.simplex,
      )
      pyro.param(
          "model_probs_y",
          torch.tensor([[0.75, 0.25], [0.55, 0.45]]),
          constraint=constraints.simplex,
      )
      pyro.param(
          "model_probs_z",
          torch.tensor([0.3, 0.7]),
          constraint=constraints.simplex,
      )
  
      @handlers.scale(scale=scale)
      def auto_model():
          probs_x = pyro.param("model_probs_x")
          probs_y = pyro.param("model_probs_y")
          probs_z = pyro.param("model_probs_z")
          x = pyro.sample("x", dist.Categorical(probs_x))
          pyro.sample(
              "y",
              dist.Categorical(probs_y[x]),
              infer={"enumerate": "parallel"},
          )
          pyro.sample(
              "z", dist.Categorical(probs_z), obs=torch.tensor(0)
          )
  
      @handlers.scale(scale=scale)
      def hand_model():
          probs_x = pyro.param("model_probs_x")
          probs_z = pyro.param("model_probs_z")
          pyro.sample("x", dist.Categorical(probs_x))
          pyro.sample(
              "z", dist.Categorical(probs_z), obs=torch.tensor(0)
          )
  
      @infer.config_enumerate
      @handlers.scale(scale=scale)
      def guide():
          probs_x = pyro.param("guide_probs_x")
          pyro.sample("x", dist.Categorical(probs_x))
  
      elbo = infer.TraceEnum_ELBO(max_plate_nesting=0)
      auto_loss = elbo.differentiable_loss(auto_model, guide)
      hand_loss = elbo.differentiable_loss(hand_model, guide)
      _check_loss_and_grads(hand_loss, auto_loss)
  
imports: import logging
  import os
  import pyroapi
  import pytest
  import torch
  from torch.autograd import grad
  from torch.distributions import constraints
  from pyro.ops.indexing import Vindex
  from pyro.util import torch_isnan
  from tests.common import assert_equal, xfail_param
label_desc: Use image node_id 3 for calling a global function with example usage: test_elbo_enumerate_1(scale) without return types