code: def add_to_loss(func):
      """The :func:`add_to_loss` decorator is used to initialise a :class:`.Callback` with the value returned from func
      being added to the loss
  
      Example: ::
  
          >>> import torch
          >>> import torchbearer
          >>> from torchbearer import Trial
          >>> from torchbearer.callbacks import add_to_loss
  
          # Example callback to add a quantity to the loss each step.
          >>> @add_to_loss
          ... def loss_callback(state):
          ...     return torch.Tensor([1.125])
  
          >>> trial = Trial(None, callbacks=[loss_callback], metrics=['loss']).for_steps(1).run()
          >>> print(trial[0][1]['loss'])
          1.125
  
  
      Args:
          func (function): The function(state) to *decorate*
  
      Returns:
          Callback: Initialised callback which adds the returned value from func to the loss
      """
  
      @on_criterion
      @on_criterion_validation
      def add_to_loss_callback(state):
          state[torchbearer.LOSS] = state[torchbearer.LOSS] + func(
              state
          )
  
      return add_to_loss_callback
  
imports: import sys
  import types
  import torchbearer
  from torchbearer.callbacks import Callback
label_desc: Use image node_id 21 for calling a global function with example usage: add_to_loss(func) and returns: add_to_loss_callback