code: def test_profile(backend, jit, n=1, num_steps=1, log_every=1):
      """
      Helper function for profiling.
      """
      print("Generating fake data")
      model = pyrocov_model_poisson
      T, P, S, F = min(n, 50), n + 1, n + 2, n + 3
      dataset = {
          "features": torch.randn(S, F),
          "local_time": torch.randn(T, P),
          "weekly_strains": torch.randn(T, P, S).exp().round(),
      }
  
      print("Initializing guide")
      guide = PoissonGuide(model, backend=backend)
      guide(dataset)  # initialize
      print("Parameter shapes:")
      for name, param in guide.named_parameters():
          print(f"  {name}: {tuple(param.shape)}")
  
      print("Training")
      Elbo = JitTrace_ELBO if jit else Trace_ELBO
      elbo = Elbo(max_plate_nesting=3, ignore_jit_warnings=True)
      svi = SVI(model, guide, ClippedAdam({"lr": 1e-8}), elbo)
      for step in range(num_steps):
          loss = svi.step(dataset)
          if log_every and step % log_every == 0:
              print(f"step {step} loss = {loss}")
  
imports: from collections import OrderedDict, namedtuple
  import pytest
  import torch
  import pyro
  import pyro.distributions
  import pyro.poutine
  from pyro.infer import SVI, JitTrace_ELBO, Predictive, Trace_ELBO
  from pyro.infer.autoguide import AutoGaussian, AutoGuideList
  from pyro.infer.autoguide.gaussian import AutoGaussianDense, AutoGaussianFunsor, _break_plates
  from pyro.infer.reparam import LocScaleReparam
  from pyro.optim import ClippedAdam
  from tests.common import assert_close, assert_equal, xfail_if_not_implemented
label_desc: Use image node_id 23 for calling a global function with example usage: test_profile(backend, jit, n, num_steps, log_every) without return types