code: def test_regex_match_prevention_prevents_and_overrides(self):
      class Net(torch.nn.Module):
          def __init__(self):
              super(Net, self).__init__()
              self.linear_1 = torch.nn.Linear(5, 10)
              self.linear_2 = torch.nn.Linear(10, 5)
              # typical actual usage: modules loaded from allenlp.model.load(..)
              self.linear_3_transfer = torch.nn.Linear(5, 10)
              self.linear_4_transfer = torch.nn.Linear(10, 5)
              self.pretrained_conv = torch.nn.Conv1d(5, 5, 5)
  
          def forward(self, inputs):  # pylint: disable=arguments-differ
              pass
  
      json_params = """{"initializer": [
          [".*linear.*", {"type": "constant", "val": 10}],
          [".*conv.*", {"type": "constant", "val": 10}],
          [".*_transfer.*", "prevent"],
          [".*pretrained.*",{"type": "prevent"}]
          ]}
          """
      params = Params(
          json.loads(_jsonnet.evaluate_snippet("", json_params))
      )
      initializers = InitializerApplicator.from_params(
          params["initializer"]
      )
      model = Net()
      initializers(model)
  
      for module in [model.linear_1, model.linear_2]:
          for parameter in module.parameters():
              assert torch.equal(
                  parameter.data, torch.ones(parameter.size()) * 10
              )
  
      transfered_modules = [
          model.linear_3_transfer,
          model.linear_4_transfer,
          model.pretrained_conv,
      ]
  
      for module in transfered_modules:
          for parameter in module.parameters():
              assert not torch.equal(
                  parameter.data, torch.ones(parameter.size()) * 10
              )
  
imports: from __future__ import division
  from __future__ import with_statement
  from __future__ import absolute_import
  import json
  import logging
  import math
  import numpy
  import pytest
  import torch
  import _jsonnet
  from allennlp.nn import InitializerApplicator, Initializer
  from allennlp.nn.initializers import block_orthogonal, uniform_unit_scaling
  from allennlp.common.checks import ConfigurationError
  from allennlp.common.testing import AllenNlpTestCase
  from allennlp.common.params import Params
label_desc: Use image node_id 8 for calling the TestInitializers obj's underlying member method code with example usage: obj.test_regex_match_prevention_prevents_and_overrides() without return types