code: def test_multinomial_goodness_of_fit():
      N = 100000
      K = 20
      logits = torch.randn(K)
      probs = (logits - logits.logsumexp(-1)).exp()
      d = dist.Categorical(probs)
      samples = d.sample((N,))
      counts = torch.zeros(K, dtype=torch.long)
      counts.scatter_add_(0, samples, torch.ones(N, dtype=torch.long))
      gof = multinomial_goodness_of_fit(probs, counts, plot=True)
      assert gof > 0.1
  
imports: import torch
  import torch.distributions
  from pyro.distributions.testing.gof import multinomial_goodness_of_fit
label_desc: Use image node_id 1 for calling a global function with example usage: test_multinomial_goodness_of_fit() without return types