code: def _test_shape(self, base_shape, transform):
      base_dist = dist.Normal(
          torch.zeros(base_shape), torch.ones(base_shape)
      )
      sample = dist.TransformedDistribution(
          base_dist, [transform]
      ).sample()
      assert sample.shape == base_shape
  
      batch_shape = base_shape[
          : len(base_shape) - transform.domain.event_dim
      ]
      input_event_shape = base_shape[
          len(base_shape) - transform.domain.event_dim :
      ]
      output_event_shape = base_shape[
          len(base_shape) - transform.codomain.event_dim :
      ]
      output_shape = batch_shape + output_event_shape
      assert (
          transform.forward_shape(input_event_shape)
          == output_event_shape
      )
      assert transform.forward_shape(base_shape) == output_shape
      assert (
          transform.inverse_shape(output_event_shape)
          == input_event_shape
      )
      assert transform.inverse_shape(output_shape) == base_shape
  
imports: import operator
  from functools import partial, reduce
  from unittest import TestCase
  import pytest
  import torch
  import pyro.distributions
  import pyro.distributions.transforms
  from pyro.distributions import constraints
  from tests.common import assert_close
label_desc: Use image node_id 4 for calling the TransformTests obj's underlying member method code with example usage: obj._test_shape(base_shape, transform) without return types