code: def assert_grads_agree(logits):
      d1 = dist.OneTwoMatching(logits)
      d2 = dist.OneTwoMatching(logits, bp_iters=BP_ITERS)
      expected = torch.autograd.grad(
          d1.log_partition_function, [logits]
      )[0]
      actual = torch.autograd.grad(d2.log_partition_function, [logits])[
          0
      ]
      assert torch.allclose(
          actual, expected, atol=0.2, rtol=1e-3
      ), f"Expected:\n{expected.numpy()}\nActual:\n{actual.numpy()}"
  
imports: import logging
  import math
  import pytest
  import torch
  import pyro.distributions
  from tests.common import assert_close, assert_equal, xfail_if_not_implemented
label_desc: Use image node_id 10 for calling a global function with example usage: assert_grads_agree(logits) without return types