code: def test_resnet50(self):
      gm_run = symbolic_trace(resnet50())
      sample_input = torch.randn(1, 3, 224, 224)
  
      # run our nodes
      ShapeProp(gm_run).propagate(sample_input)
  
      gm_static = symbolic_trace(resnet50())
  
      for n in gm_static.graph.nodes:
          n.type = None
  
      g = GraphTypeChecker({}, gm_static)
      g.type_check()
      gm_static.graph.eliminate_dead_code()
      gm_run.graph.eliminate_dead_code()
      # here we are checking for consistency with fully dynamic nodes
      for n1, n2 in zip(gm_static.graph.nodes, gm_run.graph.nodes):
          assert is_consistent(
              n1.type, TensorType(n2.meta["tensor_meta"].shape)
          )
  
      # here we give the same input as to runtime
      gm_static_with_types = symbolic_trace(resnet50())
  
      # we initialize our placeholder
      for n in gm_static_with_types.graph.nodes:
          if n.op == "placeholder":
              n.type = TensorType((1, 3, 224, 224))
  
      g = GraphTypeChecker({}, gm_static_with_types)
      g.type_check()
      for n1, n2 in zip(
          gm_static_with_types.graph.nodes, gm_run.graph.nodes
      ):
          assert n1.type == TensorType(n2.meta["tensor_meta"].shape)
  
      # apply shape inference to graph and check
      # that the batch size is equal across all layers
      infer_symbolic_types(gm_static)
  
      batch_sizes = set()
      gm_static.graph.eliminate_dead_code()
      for n in gm_static.graph.nodes:
          assert isinstance(n.type, TensorType)
          batch_sizes.add(n.type.__args__[0])
      assert len(batch_sizes) == 1
  
imports: import unittest
  import torch
  from torch.fx import symbolic_trace
  from torch.fx.experimental.unify_refinements import infer_symbolic_types
  from torch.fx.experimental.refinement_types import Equality
  from torch.fx.tensor_type import TensorType, Dyn, is_consistent, is_more_precise
  from torch.fx.annotate import annotate
  from torch.fx.experimental.graph_gradual_typechecker import GraphTypeChecker, broadcast_types, Refine
  from torch.fx.experimental.rewriter import RewritingTracer
  from torch.fx import GraphModule
  from torch.fx.passes.shape_prop import ShapeProp
  from torch.testing._internal.common_utils import TestCase
  import sympy
label_desc: Use image node_id 26 for calling the TypeCheckerTest obj's underlying member method code with example usage: obj.test_resnet50() without return types