code: def test_add_to_loss(self):
      def example(state):
          return 1
  
      state = {"test": "test", torchbearer.LOSS: 0}
      callbacks.add_to_loss(example).on_criterion(state)
      self.assertTrue(state[torchbearer.LOSS] == 1)
      callbacks.add_to_loss(example).on_criterion_validation(state)
      self.assertTrue(state[torchbearer.LOSS] == 2)
  
imports: import unittest
  import torchbearer.callbacks
  import torchbearer
label_desc: Use image node_id 22 for calling the TestDecorators obj's underlying member method code with example usage: obj.test_add_to_loss() and returns: int