docstr: Check that a graph with no constant folding is handled correctly.
  
  x  attr1
   \ /
   sub
    |
  output
docstr_tok: ["Check","that","a","graph","with","no","constant","folding","is","handled","correctly",".","x","attr1","\\","\/","sub","|","output"]
code: def test_const_fold_noop(self):
      r"""
      Check that a graph with no constant folding is handled correctly.
  
      x  attr1
       \ /
       sub
        |
      output
      """
  
      class ConstFoldTestModule(torch.nn.Module):
          def __init__(self):
              super().__init__()
              self.attr1 = torch.nn.Parameter(torch.tensor([[-0.9]]))
  
          def forward(self, x):
              return x - self.attr1
  
      mod = ConstFoldTestModule()
      mod_folded: const_fold.FoldedGraphModule = (
          const_fold.split_const_subgraphs(mod)
      )
  
      # Check that the folded graph module is None, since there was no folding to do.
      self.assertTrue(mod_folded.const_subgraph_module is None)
  
      # Now run both folded and non-folded to check results equal.
      in_x = torch.tensor([[-0.45]])
      base_result = mod(in_x)
      fold_result = mod_folded(in_x)
      self.assertTrue(torch.equal(fold_result, base_result))
  
imports: import operator
  import torch
  import torch.fx
  from torch.fx.experimental import const_fold
  from torch.fx.passes.shape_prop import _extract_tensor_metadata, ShapeProp
  from torch.testing._internal.common_utils import TestCase
label_desc: Use image node_id 6 for calling the TestConstFold obj's underlying member method code with example usage: obj.test_const_fold_noop() and returns: unknown