code: def test_persistent_bp_vs_exact(
      num_objects, num_frames, num_detections
  ):
      exists_logits = -2 * torch.rand(num_objects)
      assign_logits = (
          2 * torch.rand(num_frames, num_detections, num_objects) - 1
      )
      expected = MarginalAssignmentPersistent(
          exists_logits, assign_logits, None
      )
      actual = MarginalAssignmentPersistent(
          exists_logits, assign_logits, 30
      )
      # these should only approximately agree
      assert_equal(
          expected.exists_dist.probs,
          actual.exists_dist.probs,
          prec=0.05,
      )
      assert_equal(
          expected.assign_dist.probs,
          actual.assign_dist.probs,
          prec=0.05,
      )
  
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 15 for calling a global function with example usage: test_persistent_bp_vs_exact(num_objects, num_frames, num_detections) without return types