code: def test_persistent_smoke(bp_iters):
      exists_logits = torch.tensor(
          [-1.0, -1.0, -2.0], requires_grad=True
      )
      assign_logits = torch.tensor(
          [
              [[-1.0, -INF, -INF], [-2.0, -2.0, -INF]],
              [[-1.0, -2.0, -3.0], [-2.0, -2.0, -1.0]],
              [[-1.0, -2.0, -3.0], [-2.0, -2.0, -1.0]],
              [[-1.0, -1.0, 1.0], [1.0, 1.0, -1.0]],
          ],
          requires_grad=True,
      )
  
      assignment = MarginalAssignmentPersistent(
          exists_logits, assign_logits, bp_iters=bp_iters
      )
      assert assignment.num_frames == 4
      assert assignment.num_detections == 2
      assert assignment.num_objects == 3
  
      assign_dist = assignment.assign_dist
      exists_dist = assignment.exists_dist
      assert_finite(exists_dist.probs, "exists_probs")
      assert_finite(assign_dist.probs, "assign_probs")
  
      for exists in exists_dist.enumerate_support():
          log_prob = exists_dist.log_prob(exists).sum()
          e_grad, a_grad = grad(
              log_prob,
              [exists_logits, assign_logits],
              create_graph=True,
          )
          assert_finite(e_grad, "dexists_probs/dexists_logits")
          assert_finite(a_grad, "dexists_probs/dassign_logits")
  
      for assign in assign_dist.enumerate_support():
          log_prob = assign_dist.log_prob(assign).sum()
          e_grad, a_grad = grad(
              log_prob,
              [exists_logits, assign_logits],
              create_graph=True,
          )
          assert_finite(e_grad, "dassign_probs/dexists_logits")
          assert_finite(a_grad, "dassign_probs/dassign_logits")
  
imports: import logging
  import pytest
  import torch
  from torch.autograd import grad
  import pyro
  import pyro.distributions
  from pyro.contrib.tracking.assignment import MarginalAssignment, MarginalAssignmentPersistent, MarginalAssignmentSparse
  from tests.common import assert_equal
label_desc: Use image node_id 8 for calling a global function with example usage: test_persistent_smoke(bp_iters) without return types