code: def test_bump_numeric_counter(self):
      class ModuleThatLogs(torch.jit.ScriptModule):
          @torch.jit.script_method
          def forward(self, x):
              for i in range(x.size(0)):
                  x += 1.0
                  torch.jit._logging.add_stat_value("foo", 1)
  
              if bool(x.sum() > 0.0):
                  torch.jit._logging.add_stat_value("positive", 1)
              else:
                  torch.jit._logging.add_stat_value("negative", 1)
              return x
  
      logger = torch.jit._logging.LockingLogger()
      old_logger = torch.jit._logging.set_logger(logger)
      try:
          mtl = ModuleThatLogs()
          for i in range(5):
              mtl(torch.rand(3, 4, 5))
  
          self.assertEqual(logger.get_counter_val("foo"), 15)
          self.assertEqual(logger.get_counter_val("positive"), 5)
      finally:
          torch.jit._logging.set_logger(old_logger)
  
file_path: pytorch/test/jit/test_logging.py
imports: import os
  import sys
  import torch
  from torch.testing._internal.jit_utils import JitTestCase
label_desc: Use image node_id 1 for calling the TestLogging obj's underlying member method code with example usage: obj.test_bump_numeric_counter() and returns: x