class_docstr: Test Case: To test simple fork/wait operation in a graph
  fork is called on simple addition operation on input tensors
class_docstr_tok: ["Test","Case",":","To","test","simple","fork\/wait","operation","in","a","graph","fork","is","called","on","simple","addition","operation","on","input","tensors"]
docstr: TorchScript IR of TestModule() after freezing:
  graph(%self : __torch__.test_static_runtime.___torch_mangle_0.TestModule,
        %x.1 : Tensor):
      %18 : int = prim::Constant[value=30]()
      %30 : int = prim::Constant[value=13]()
      %3 : int = prim::Constant[value=20]()
      %2 : int = prim::Constant[value=1]()
      %self.sub2.a : int = prim::Constant[value=12]()
      %self.a : int = prim::Constant[value=3]()
      = prim::SetAttr[name="b"](%self, %3)
      %17 : Tensor = aten::add(%x.1, %30, %2)
      %7 : Tensor = aten::add(%17, %self.a, %2)
      %b.1 : int = prim::GetAttr[name="b"](%self)
      %9 : Tensor = aten::add(%7, %b.1, %2)
      %sub2 : __torch__.test_static_runtime.___torch_mangle_2.SubModule2 = prim::GetAttr[name="sub2"](%self)
      = prim::SetAttr[name="b"](%sub2, %18)
      %b : int = prim::GetAttr[name="b"](%sub2)
      %22 : int = aten::add(%self.sub2.a, %b)
      %23 : Tensor = aten::add(%x.1, %22, %2)
      %12 : Tensor = aten::add(%9, %23, %2)
      return (%12)
docstr_tok: ["TorchScript","IR","of","TestModule","(",")","after","freezing",":","graph","(","%","self",":","__torch__.test_static_runtime.___torch_mangle_0.TestModule",",","%","x.1",":","Tensor",")",":","%","18",":","int","=","prim",":",":Constant","[","value=30","]","(",")","%","30",":","int","=","prim",":",":Constant","[","value=13","]","(",")","%","3",":","int","=","prim",":",":Constant","[","value=20","]","(",")","%","2",":","int","=","prim",":",":Constant","[","value=1","]","(",")","%","self.sub2.a",":","int","=","prim",":",":Constant","[","value=12","]","(",")","%","self.a",":","int","=","prim",":",":Constant","[","value=3","]","(",")","=","prim",":",":SetAttr","[","name=","''","b","''","]","(","%","self",",","%","3",")","%","17",":","Tensor","=","aten",":",":add","(","%","x.1",",","%","30",",","%","2",")","%","7",":","Tensor","=","aten",":",":add","(","%","17",",","%","self.a",",","%","2",")","%","b.1",":","int","=","prim",":",":GetAttr","[","name=","''","b","''","]","(","%","self",")","%","9",":","Tensor","=","aten",":",":add","(","%","7",",","%","b.1",",","%","2",")","%","sub2",":","__torch__.test_static_runtime.___torch_mangle_2.SubModule2","=","prim",":",":GetAttr","[","name=","''","sub2","''","]","(","%","self",")","=","prim",":",":SetAttr","[","name=","''","b","''","]","(","%","sub2",",","%","18",")","%","b",":","int","=","prim",":",":GetAttr","[","name=","''","b","''","]","(","%","sub2",")","%","22",":","int","=","aten",":",":add","(","%","self.sub2.a",",","%","b",")","%","23",":","Tensor","=","aten",":",":add","(","%","x.1",",","%","22",",","%","2",")","%","12",":","Tensor","=","aten",":",":add","(","%","9",",","%","23",",","%","2",")","return","(","%","12",")"]
code: def test_attr(self):
      """
      TorchScript IR of TestModule() after freezing:
      graph(%self : __torch__.test_static_runtime.___torch_mangle_0.TestModule,
            %x.1 : Tensor):
          %18 : int = prim::Constant[value=30]()
          %30 : int = prim::Constant[value=13]()
          %3 : int = prim::Constant[value=20]()
          %2 : int = prim::Constant[value=1]()
          %self.sub2.a : int = prim::Constant[value=12]()
          %self.a : int = prim::Constant[value=3]()
          = prim::SetAttr[name="b"](%self, %3)
          %17 : Tensor = aten::add(%x.1, %30, %2)
          %7 : Tensor = aten::add(%17, %self.a, %2)
          %b.1 : int = prim::GetAttr[name="b"](%self)
          %9 : Tensor = aten::add(%7, %b.1, %2)
          %sub2 : __torch__.test_static_runtime.___torch_mangle_2.SubModule2 = prim::GetAttr[name="sub2"](%self)
          = prim::SetAttr[name="b"](%sub2, %18)
          %b : int = prim::GetAttr[name="b"](%sub2)
          %22 : int = aten::add(%self.sub2.a, %b)
          %23 : Tensor = aten::add(%x.1, %22, %2)
          %12 : Tensor = aten::add(%9, %23, %2)
          return (%12)
      """
      # test prim::SetAttr and prim::GetAttr impl in Static Runtime
      m = TestModule()
  
      m.eval()
      input = torch.randn(2, 2)
      output_s = m.forward(input)
  
      ms = torch.jit.script(m)
      sm = StaticModule(ms)
      output_sm = sm(input)
      torch.testing.assert_close(output_s, output_sm)
      sm.benchmark([input], {}, 2, 2)
      sm.benchmark_individual_ops([input], {}, 2, 2)
      sm.benchmark([], {"x": input}, 2, 2)
      sm.benchmark_individual_ops([], {"x": input}, 2, 2)
  
imports: import unittest
  from typing import Dict, Optional
  import numpy
  import torch
  from torch import nn
  from torch.testing._internal.common_utils import TestCase, run_tests
  from typing import List
label_desc: Use image node_id 16 for calling the TestStaticModule obj's underlying member method code with example usage: obj.test_attr() without return types