code: def test_grad_hard(num_nodes):
      i = torch.arange(num_nodes)
      logits = torch.randn(num_nodes, num_nodes) * 10
      logits[i[:, None] < i] = -100
      logits.requires_grad_()
  
      assert_grads_ok(logits)
      assert_grads_ok(logits, bp_iters=BP_ITERS)
      assert_grads_agree(logits)
  
file_path: pyro/tests/distributions/test_one_one_matching.py
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 9 for calling a global function with example usage: test_grad_hard(num_nodes) without return types