code: def test_sparse_grid_smoke():
      def my_existence_prior(ox, oy):
          return -0.5
  
      def my_assign_prior(ox, oy, dx, dy):
          return 0.0
  
      num_detections = 3 * 3
      detections = [[0, 1, 2], [3, 4, 5], [6, 7, 8]]
      num_objects = 2 * 2
      objects = [[0, 1], [2, 3]]
      edges = []
      edge_coords = []
      for x in range(2):
          for y in range(2):
              object_id = objects[x][y]
              for dx in [0, 1]:
                  for dy in [0, 1]:
                      detection_id = detections[x + dx][y + dy]
                      edges.append((detection_id, object_id))
                      edge_coords.append((x, y, x + dx, y + dy))
  
      exists_logits = torch.empty(num_objects)
      edges = exists_logits.new_tensor(edges, dtype=torch.long).t()
      assert edges.shape == (2, 4 * 4)
  
      for x in range(2):
          for y in range(2):
              object_id = objects[x][y]
              exists_logits[object_id] = my_existence_prior(x, y)
      assign_logits = exists_logits.new_tensor(
          [
              my_assign_prior(ox, oy, dx, dy)
              for ox, oy, dx, dy in edge_coords
          ]
      )
      assign = MarginalAssignmentSparse(
          num_objects,
          num_detections,
          edges,
          exists_logits,
          assign_logits,
          bp_iters=10,
      )
      assert isinstance(assign.assign_dist, dist.Categorical)
  
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 7 for calling a global function with example usage: test_sparse_grid_smoke() and returns: unknown, int