code: def test_detach_jit(shape):
      loc = torch.tensor(0.0, requires_grad=True)
      scale = torch.tensor(1.0, requires_grad=True)
      data = torch.randn(5, 1, 1)
  
      def fn(loc, scale, data):
          d = dist.Normal(loc, scale, validate_args=False)
          if shape is not None:
              d = d.expand(shape)
          return detach(d).log_prob(data)
  
      jit_fn = torch.jit.trace(fn, (loc, scale, data))
  
      expected = fn(loc, scale, data)
      actual = jit_fn(loc, scale, data)
      assert not expected.requires_grad
      assert not actual.requires_grad
      assert_equal(actual, expected)
  
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 11 for calling a global function with example usage: test_detach_jit(shape) and returns: detach