class_docstr: Create a WeightDecay callback which uses the given norm on the given parameters and with the given decay rate.
  If params is None (default) then the parameters will be retrieved from the model.
  
  Example: ::
  
      >>> from torchbearer import Trial
      >>> from torchbearer.callbacks import WeightDecay
  
      # Example Trial which runs a trial with weight decay on the model
      >>> decay = WeightDecay()
      >>> trial = Trial(None, callbacks=[decay], metrics=['loss'], verbose=2).for_steps(10).run(1)
  
  Args:
      rate (float): The decay rate or lambda
      p (int): The norm level
      params (Iterable[Tensor] or Tensor, optional): an iterable of Tensors or a
          single Tensor that will have gradients normalized, otherwise this is retrieved from state
  
  State Requirements:
      - :attr:`torchbearer.state.MODEL`: Model should have the `parameters` method
      - :attr:`torchbearer.state.LOSS`: Loss should be a tensor that can be incremented
docstr: Retrieve params from state['model'] if required.
  
  Args:
      state (dict): The :class:`.Trial` state
docstr_tok: ["Retrieve","params","from","state","[","'model","'","]","if","required",".","Args",":","state","(","dict",")",":","The",":","class",":","`",".Trial","`","state"]
code: def on_start(self, state):
      """Retrieve params from state['model'] if required.
  
      Args:
          state (dict): The :class:`.Trial` state
      """
      if self.params is None:
          self.params = state[torchbearer.MODEL].parameters()
  
file_path: torchbearer/torchbearer/callbacks/weight_decay.py
imports: import torchbearer
  from torchbearer.callbacks import Callback
  import torch
label_desc: Use image node_id 2 for calling the WeightDecay obj's underlying member method code with example usage: obj.on_start(state) without return types