code: def test_module_partitioner_conv_relu_maxpool(self):
      class M(torch.nn.Module):
          def __init__(self, constant_tensor: torch.Tensor) -> None:
              super().__init__()
              self.constant_tensor = constant_tensor
              self.conv1 = torch.nn.Conv2d(
                  in_channels=3,
                  out_channels=16,
                  kernel_size=3,
                  padding=1,
              )
              self.conv2 = torch.nn.Conv2d(
                  in_channels=16,
                  out_channels=16,
                  kernel_size=3,
                  padding=1,
              )
              self.conv3 = torch.nn.Conv2d(
                  in_channels=16,
                  out_channels=16,
                  kernel_size=3,
                  padding=1,
              )
              self.relu = torch.nn.ReLU()
              self.maxpool = torch.nn.MaxPool2d(kernel_size=3)
  
          def forward(self, x: torch.Tensor) -> torch.Tensor:
              a = self.conv1(x)
              b = self.conv2(a)
              c = a + self.constant_tensor
              z = self.conv3(b + c)
              return self.maxpool(self.relu(z))
  
      inputs = (torch.randn(1, 3, 256, 256),)
      gm, _ = torch._dynamo.export(
          M(torch.ones(1, 16, 256, 256)), aten_graph=True
      )(*inputs)
      gm.graph.eliminate_dead_code()
  
      module_partitions = get_source_partitions(
          gm.graph, [torch.nn.Conv2d, torch.nn.ReLU, torch.nn.MaxPool2d]
      )
  
      self.assertEqual(len(module_partitions), 3)
      self.assertEqual(len(module_partitions[torch.nn.Conv2d]), 3)
      self.assertEqual(len(module_partitions[torch.nn.ReLU]), 1)
      self.assertEqual(len(module_partitions[torch.nn.MaxPool2d]), 1)
  
      self.assertFalse(
          check_subgraphs_connected(
              module_partitions[torch.nn.Conv2d][0],
              module_partitions[torch.nn.ReLU][0],
          )
      )
      self.assertFalse(
          check_subgraphs_connected(
              module_partitions[torch.nn.Conv2d][1],
              module_partitions[torch.nn.ReLU][0],
          )
      )
      self.assertTrue(
          check_subgraphs_connected(
              module_partitions[torch.nn.Conv2d][2],
              module_partitions[torch.nn.ReLU][0],
          )
      )
      self.assertFalse(
          check_subgraphs_connected(
              module_partitions[torch.nn.MaxPool2d][0],
              module_partitions[torch.nn.ReLU][0],
          )
      )
      self.assertTrue(
          check_subgraphs_connected(
              module_partitions[torch.nn.ReLU][0],
              module_partitions[torch.nn.MaxPool2d][0],
          )
      )
  
file_path: pytorch/test/fx/test_source_matcher_utils.py
imports: import os
  import sys
  import unittest
  import torch
  from torch._dynamo.eval_frame import is_dynamo_supported
  from torch.fx.passes.utils.source_matcher_utils import get_source_partitions, check_subgraphs_connected
  from torch.testing._internal.jit_utils import JitTestCase
label_desc: Use image node_id 2 for calling the TestSourceMatcher obj's underlying member method code with example usage: obj.test_module_partitioner_conv_relu_maxpool() and returns: self