code: def test_autograd():
      predictor = torch.randn(5, requires_grad=True)
      order = OrderedTransform()
      pre_cutpoints = torch.randn(3, requires_grad=True)
      cutpoints = order(pre_cutpoints)
      data = torch.tensor([0, 1, 2, 3, 0], dtype=float)
  
      dist = OrderedLogistic(predictor, cutpoints, validate_args=True)
      dist.log_prob(data).sum().backward()
  
      assert predictor.grad is not None
      assert torch.all(predictor.grad != 0).item()
      assert pre_cutpoints.grad is not None
      assert torch.all(pre_cutpoints.grad != 0).item()
  
file_path: pyro/tests/distributions/test_ordered_logistic.py
imports: import pytest
  import torch
  from torch.autograd.functional import jacobian
  from pyro.distributions import Normal, OrderedLogistic
  from pyro.distributions.transforms import OrderedTransform
label_desc: Use image node_id 5 for calling a global function with example usage: test_autograd() without return types