code: def test_nested_parameterized():
      class Linear(Parameterized):
          def __init__(self, a):
              super().__init__()
              self.a = Parameter(a)
  
          def forward(self, x):
              return self.a * x
  
      class Quadratic(Parameterized):
          def __init__(self, linear1, linear2, a):
              super().__init__()
              self._pyro_name = "Quadratic"
              self.linear1 = linear1
              self.linear2 = linear2
              self.a = Parameter(a)
  
          def forward(self, x):
              return self.linear1(x) * x + self.linear2(self.a)
  
      linear1 = Linear(torch.tensor(1.0))
      linear1.a = PyroSample(dist.Normal(0, 1))
      linear2 = Linear(torch.tensor(1.0))
      linear2.a = PyroSample(dist.Normal(0, 1))
      q = Quadratic(linear1, linear2, torch.tensor(2.0))
      q.a = PyroSample(dist.Cauchy(0, 1))
  
      def model(x):
          q.set_mode("model")
          return q(x)
  
      trace = pyro.poutine.trace(model).get_trace(torch.tensor(5.0))
      assert "Quadratic.a" in trace.nodes
      assert "Quadratic.linear1.a" in trace.nodes
      assert "Quadratic.linear2.a" in trace.nodes
  
file_path: pyro/tests/contrib/gp/test_parameterized.py
imports: import torch
  from torch.distributions import constraints
  from torch.nn import Parameter
  import pyro
  import pyro.distributions
  from pyro.contrib.gp.parameterized import Parameterized
  from pyro.nn.module import PyroParam, PyroSample
  from tests.common import assert_equal
label_desc: Use image node_id 2 for calling a global function with example usage: test_nested_parameterized() and returns: q, unknown, unknown