docstr: Perform constant folding conversion, from original mod to split constant
  folding module with two split subgraphs, where there are two attrs to
  fold into two new attrs.
  
     attr1        attr2          attr1     attr2
     /    \         |           /     \      |
  permute  |       sum       permute   |    sum
      \   /        /                \ /      |
   x   add    y   /                 add      |
    \ /        \ /                   |       |
    sub        add                 output  output     (become attrs add_1 and mul_1)
       \       /        ==>   --------+-------+------ (const/base subgraph split)
        \     /                   x   |   y   |       (inputs from previous subgraph
          add                      \ /     \ /         are attrs)
           |                       sub     add
         linear                       \   /
           |                           add
         sigmoid                        |
           |                          linear
         output                         |
                                      sigmoid
                                        |
                                      output
docstr_tok: ["Perform","constant","folding","conversion",",","from","original","mod","to","split","constant","folding","module","with","two","split","subgraphs",",","where","there","are","two","attrs","to","fold","into","two","new","attrs",".","attr1","attr2","attr1","attr2","\/","\\","|","\/","\\","|","permute","|","sum","permute","|","sum","\\","\/","\/","\\","\/","|","x","add","y","\/","add","|","\\","\/","\\","\/","|","|","sub","add","output","output","(","become","attrs","add_1","and","mul_1",")","\\","\/","==",">","--","--","--","--","+","--","--","--","-+","--","--","--","(","const\/base","subgraph","split",")","\\","\/","x","|","y","|","(","inputs","from","previous","subgraph","add","\\","\/","\\","\/","are","attrs",")","|","sub","add","linear","\\","\/","|","add","sigmoid","|","|","linear","output","|","sigmoid","|","output"]
code: def test_const_fold_multi_const_folded_attrs(self):
      r"""
      Perform constant folding conversion, from original mod to split constant
      folding module with two split subgraphs, where there are two attrs to
      fold into two new attrs.
  
         attr1        attr2          attr1     attr2
         /    \         |           /     \      |
      permute  |       sum       permute   |    sum
          \   /        /                \ /      |
       x   add    y   /                 add      |
        \ /        \ /                   |       |
        sub        add                 output  output     (become attrs add_1 and mul_1)
           \       /        ==>   --------+-------+------ (const/base subgraph split)
            \     /                   x   |   y   |       (inputs from previous subgraph
              add                      \ /     \ /         are attrs)
               |                       sub     add
             linear                       \   /
               |                           add
             sigmoid                        |
               |                          linear
             output                         |
                                          sigmoid
                                            |
                                          output
      """
  
      class ConstFoldTestModule(torch.nn.Module):
          def __init__(self):
              super().__init__()
              self.attr1 = torch.nn.Parameter(torch.randn(4, 4))
              self.attr2 = torch.nn.Parameter(torch.randn(4, 4))
              self.lin = torch.nn.Linear(4, 4)
  
          def forward(self, x, y):
              a = self.attr1 + self.attr1.permute(1, 0)
              x = x - a
              amax = torch.sum(self.attr2, dim=1)
              y = y + amax
              return torch.sigmoid(self.lin(x + y))
  
      mod = ConstFoldTestModule()
      mod_folded: const_fold.FoldedGraphModule = (
          const_fold.split_const_subgraphs(mod)
      )
      self._verify_const_fold_mod(mod_folded)
  
      # Now run both folded and non-folded to check results equal.
      in_x, in_y = torch.randn(4, 4), torch.randn(4)
      fold_result = mod_folded(in_x, in_y)
      base_result = mod(in_x, in_y)
      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 9 for calling the TestConstFold obj's underlying member method code with example usage: obj.test_const_fold_multi_const_folded_attrs() and returns: torch