code: def test_persistent_exact_5_4_3(e1, e2, e3, bp_iters, bp_momentum):
      exists_logits = torch.tensor([e1, e2, e3])
      assign_logits = 2 * torch.rand(5, 4, 3) - 1
      # this has tree-shaped connectivity and should lead to exact inference
      mask = torch.tensor(
          [
              [[1, 1, 0], [0, 1, 0], [0, 0, 1], [1, 0, 0]],
              [[1, 0, 0], [0, 1, 1], [0, 0, 1], [1, 0, 0]],
              [[1, 0, 0], [0, 1, 0], [0, 0, 1], [1, 0, 0]],
              [[1, 0, 0], [0, 1, 0], [0, 0, 1], [0, 1, 0]],
              [[1, 0, 0], [0, 1, 0], [0, 0, 1], [0, 0, 1]],
          ],
          dtype=torch.bool,
      )
      assign_logits[~mask] = -INF
      expected = MarginalAssignmentPersistent(
          exists_logits, assign_logits, None
      )
      actual = MarginalAssignmentPersistent(
          exists_logits, assign_logits, bp_iters, bp_momentum
      )
      assert_equal(expected.exists_dist.probs, actual.exists_dist.probs)
      assert_equal(expected.assign_dist.probs, actual.assign_dist.probs)
      logger.debug(actual.exists_dist.probs)
      logger.debug(actual.assign_dist.probs)
  
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 16 for calling a global function with example usage: test_persistent_exact_5_4_3(e1, e2, e3, bp_iters, bp_momentum) without return types