code: def test_local_param_global_behavior_fails(local_params):
      class Model(PyroModule):
          def __init__(self):
              super().__init__()
              self.global_nn_param = nn.Parameter(torch.zeros(2))
  
          def forward(self):
              global_param = pyro.param(
                  "_global_param", lambda: torch.randn(2)
              )
              global_nn_param = pyro.param(
                  "global_nn_param", self.global_nn_param
              )
              return global_param, global_nn_param
  
      with pyro.settings.context(module_local_params=local_params):
          model = Model()
          if local_params:
              assert pyro.settings.get("module_local_params")
              with pytest.raises(NotImplementedError):
                  model()
          else:
              assert not pyro.settings.get("module_local_params")
              model()
  
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 3 for calling a global function with example usage: test_local_param_global_behavior_fails(local_params) and returns: global_param,  global_nn_param