code: def test_memory_history_inductor(self):
      def called_inside_compile(x, w, b):
          a = x @ w + b
          return torch.sigmoid(a)
  
      @torch.compile
      def fn(x, w, b):
          x = called_inside_compile(x, w, b)
          return called_inside_compile(x, w, b)
  
      w = torch.rand(3, 3, device="cuda")
      b = torch.rand(3, device="cuda")
      x = torch.rand(3, device="cuda")
      try:
          torch.cuda.memory.empty_cache()
          torch.cuda.memory._record_memory_history(True)
          r = fn(x, w, b)
      finally:
          torch.cuda.memory._record_memory_history(False)
      snapshot = str(torch.cuda.memory._snapshot())
      self.assertTrue("called_inside_compile" in snapshot)
  
imports: import math
  import sys
  import unittest
  import torch
  import torch._dynamo.config
  import torch.backends.cuda
  import torch.nn.functional
  from torch import nn
  from torch._dynamo.debug_utils import same_two_models
  from torch._dynamo.testing import rand_strided
  from torch._dynamo.utils import same
  from torch._inductor import config
  from torch._inductor.compile_fx import compile_fx_inner
  from torch.fx.experimental.proxy_tensor import make_fx
  from torch.testing._internal.common_cuda import PLATFORM_SUPPORTS_FLASH_ATTENTION
  from torch.testing._internal.common_utils import DeterministicGuard, freeze_rng_state, IS_FBCODE, skipIfRocm, TEST_WITH_ASAN
label_desc: Use image node_id 24 for calling the CudaReproTests obj's underlying member method code with example usage: obj.test_memory_history_inductor() and returns: torch, called_inside_compile