code: def test_kl_independent_normal(batch_shape, event_shape):
      shape = batch_shape + event_shape
      p = dist.Normal(torch.randn(shape), torch.randn(shape).exp())
      q = dist.Normal(torch.randn(shape), torch.randn(shape).exp())
      actual = kl_divergence(
          dist.Independent(p, len(event_shape)),
          dist.Independent(q, len(event_shape)),
      )
      expected = sum_rightmost(kl_divergence(p, q), len(event_shape))
      assert_close(actual, expected)
  
file_path: pyro/tests/distributions/test_kl.py
imports: import pytest
  import torch
  from torch.distributions import kl_divergence, transforms
  import pyro.distributions
  from pyro.distributions.util import sum_rightmost
  from tests.common import assert_close
label_desc: Use image node_id 3 for calling a global function with example usage: test_kl_independent_normal(batch_shape, event_shape) without return types