code: def test_deep_to_transformed(shape, dtype):
      loc = torch.tensor(0.0, requires_grad=True)
      scale = torch.tensor(1.0, requires_grad=False)
      a = torch.tensor(2.0, requires_grad=True)
      b = torch.tensor(3.0, requires_grad=False)
      d1 = dist.TransformedDistribution(
          dist.Normal(loc, scale), dist.transforms.AffineTransform(a, b)
      )
      if shape is not None:
          d1 = d1.expand(shape)
  
      d2 = deep_to(d1, dtype)
      d2.log_prob(d2.sample().detach())  # smoke test
      assert type(d1) is type(d2)
      assert d2.event_shape == d1.event_shape
      assert d2.batch_shape == d1.batch_shape
      assert type(d1.base_dist) is type(d2.base_dist)
      assert len(d1.transforms) == len(d2.transforms)
      assert_equal(d1.base_dist.loc.to(dtype), d2.base_dist.loc)
      assert_equal(d1.base_dist.scale.to(dtype), d2.base_dist.scale)
      assert_equal(d1.transforms[0].loc.to(dtype), d2.transforms[0].loc)
      assert_equal(
          d1.transforms[0].scale.to(dtype), d2.transforms[0].scale
      )
      assert d2.base_dist.loc.requires_grad
      assert not d2.base_dist.scale.requires_grad
      assert d2.transforms[0].loc.requires_grad
      assert not d2.transforms[0].scale.requires_grad
  
imports: import weakref
  import numpy
  import pytest
  import torch
  from torch.autograd import grad
  import pyro.distributions
  from pyro.distributions import constraints
  from pyro.distributions.util import broadcast_shape, deep_to, detach, sum_leftmost, sum_rightmost, weakmethod
  from pyro.nn.module import PyroModule, PyroParam, PyroSample
  from tests.common import assert_equal
label_desc: Use image node_id 14 for calling a global function with example usage: test_deep_to_transformed(shape, dtype) without return types