code: def test_rate(self):
      model = nn.Sequential(nn.Conv2d(3, 3, 3))
      model.parameters = Mock(
          return_value=[nn.Parameter(torch.Tensor([2.0]))]
      )
      state = {torchbearer.MODEL: model, torchbearer.LOSS: 1}
  
      decay = WeightDecay(0.5, 1.0)
      decay.on_start(state)
      decay.on_criterion(state)
  
      self.assertTrue(state[torchbearer.LOSS].item() == 2)
  
file_path: torchbearer/tests/callbacks/test_weight_decay.py
imports: from unittest import TestCase
  import torch
  import torch.nn
  from mock import Mock, patch
  import torchbearer
  from torchbearer.callbacks import WeightDecay, L1WeightDecay, L2WeightDecay
label_desc: Use image node_id 3 for calling the TestWeightDecay obj's underlying member method code with example usage: obj.test_rate() without return types