code: def test_memory_computation(self, wd):
      def check_memory(model, expected):
          self.open_html_model(wd, model)
          memory_table = self.open_section_and_get_body(
              wd, "Tensor Memory"
          )
          device = memory_table.find_element_by_xpath(
              "//table/tbody/tr[1]/td[1]"
          ).text
          self.assertEqual("cpu", device)
          memory_usage_str = memory_table.find_element_by_xpath(
              "//table/tbody/tr[1]/td[2]"
          ).text
          self.assertEqual(expected, int(memory_usage_str))
  
      simple_model_memory = (
          # First layer, including bias.
          64 * (16 + 1)
          +
          # Second layer, including bias.
          8 * (64 + 1)
          # 32-bit float
      ) * 4
  
      check_memory(torch.jit.script(SimpleModel()), simple_model_memory)
  
      # The same SimpleModel instance appears twice in this model.
      # The tensors will be shared, so ensure no double-counting.
      a_simple_model = SimpleModel()
      check_memory(
          torch.jit.script(
              torch.nn.Sequential(a_simple_model, a_simple_model)
          ),
          simple_model_memory,
      )
  
      # The freezing process will move the weight and bias
      # from data to constants.  Ensure they are still counted.
      check_memory(
          torch.jit.freeze(torch.jit.script(SimpleModel()).eval()),
          simple_model_memory,
      )
  
      # Make sure we can handle a model with both constants and data tensors.
      class ComposedModule(torch.nn.Module):
          def __init__(self):
              super().__init__()
              self.w1 = torch.zeros(1, 2)
              self.w2 = torch.ones(2, 2)
  
          def forward(self, arg):
              return arg * self.w2 + self.w1
  
      check_memory(
          torch.jit.freeze(
              torch.jit.script(ComposedModule()).eval(),
              preserved_attrs=["w1"],
          ),
          4 * (2 + 4),
      )
  
imports: import os
  import io
  import functools
  import tempfile
  import urllib
  import unittest
  import torch
  import torch.backends.xnnpack
  import torch.utils.model_dump
  import torch.utils.mobile_optimizer
  from torch.testing._internal.common_utils import TestCase, run_tests, IS_WINDOWS, skipIfNoXNNPACK
  from torch.testing._internal.common_quantized import supported_qengines
label_desc: Use image node_id 14 for calling the TestModelDump obj's underlying member method code with example usage: obj.test_memory_computation(wd) and returns: unknown