code: def test_l2_regularization(self):
      model = torch.nn.Sequential(
          torch.nn.Linear(5, 10), torch.nn.Linear(10, 5)
      )
      constant_init = Initializer.from_params(
          Params({"type": "constant", "val": 0.5})
      )
      initializer = InitializerApplicator([(".*", constant_init)])
      initializer(model)
      value = RegularizerApplicator([("", L2Regularizer(1.0))])(model)
      assert value.data.numpy() == 28.75
  
file_path: allennlp/tests/nn/regularizers_test.py
imports: import re
  import torch
  from allennlp.common.params import Params
  from allennlp.nn import InitializerApplicator, Initializer
  from allennlp.nn.regularizers import L1Regularizer, L2Regularizer, RegularizerApplicator
  from allennlp.common.testing import AllenNlpTestCase
label_desc: Use image node_id 2 for calling the TestRegularizers obj's underlying member method code with example usage: obj.test_l2_regularization() without return types