code: def test_hierarchy_prior_cached():
      def hierarchy_prior(module):
          latent = pyro.sample("a", dist.Normal(0, 1))
          return dist.Normal(latent, 1)
  
      class Model(PyroModule):
          def __init__(self):
              super().__init__()
              self.b = PyroSample(hierarchy_prior)
  
          def forward(self):
              return self.b + self.b
  
      model = Model()
      trace = poutine.trace(model).get_trace()
      assert "a" in trace.nodes
  
imports: import io
  import warnings
  import pytest
  import torch
  from torch import nn
  from torch.distributions import constraints, transform_to
  import pyro
  import pyro.distributions
  from pyro import poutine
  from pyro.infer import SVI, Trace_ELBO
  from pyro.nn.module import PyroModule, PyroParam, PyroSample, clear, to_pyro_module_
  from pyro.optim import Adam
  from tests.common import assert_equal
label_desc: Use image node_id 9 for calling a global function with example usage: test_hierarchy_prior_cached() and returns: dist, unknown