code: def test_kl_transformed_transformed(shape, event_dim, transform):
      p_base = dist.Normal(
          torch.zeros(shape), torch.ones(shape)
      ).to_event(event_dim)
      q_base = dist.Normal(
          torch.ones(shape) * 2, torch.ones(shape)
      ).to_event(event_dim)
      p = dist.TransformedDistribution(p_base, transform)
      q = dist.TransformedDistribution(q_base, transform)
      kl = kl_divergence(q, p)
      expected_shape = (
          shape[:-1]
          if max(transform.event_dim, event_dim) == 1
          else shape
      )
      assert kl.shape == expected_shape
  
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 6 for calling a global function with example usage: test_kl_transformed_transformed(shape, event_dim, transform) without return types