code: def _annotate_max_pool2d(
      gm: torch.fx.GraphModule,
      quantization_config: Optional[QuantizationConfig],
      filter_fn: Optional[Callable[[Node], bool]] = None,
  ) -> Optional[List[List[Node]]]:
      module_partitions = get_source_partitions(
          gm.graph,
          [torch.nn.MaxPool2d, torch.nn.functional.max_pool2d],
          filter_fn,
      )
      maxpool_partitions = list(
          itertools.chain.from_iterable(module_partitions.values())
      )
      annotated_partitions = []
      for maxpool_partition in maxpool_partitions:
          annotated_partitions.append(maxpool_partition.nodes)
          output_node = maxpool_partition.output_nodes[0]
          maxpool_node = None
          for n in maxpool_partition.nodes:
              if n.target == torch.ops.aten.max_pool2d.default:
                  maxpool_node = n
          assert (
              maxpool_node is not None
          ), "XNNPACKQuantizer only works with torch.ops.aten.max_pool2d.default, "
          "please make sure you are exporting the model correctly"
          if _is_annotated([output_node, maxpool_node]):  # type: ignore[list-item]
              continue
  
          input_act = maxpool_node.args[0]  # type: ignore[union-attr]
          assert isinstance(input_act, Node)
  
          # only annotate maxpool when the output of the input node is annotated
          if (
              "quantization_annotation" not in input_act.meta
              or not input_act.meta[
                  "quantization_annotation"
              ]._annotated
              or input_act.meta["quantization_annotation"].output_qspec
              is None
          ):
              continue
          # input and output of maxpool will share quantization parameter with input of maxpool
          act_qspec = SharedQuantizationSpec(input_act)
          # act_qspec = get_act_qspec(quantization_config)
          maxpool_node.meta["quantization_annotation"] = QuantizationAnnotation(  # type: ignore[union-attr]
              input_qspec_map={
                  input_act: act_qspec,
              },
              _annotated=True,
          )
          output_node.meta[
              "quantization_annotation"
          ] = QuantizationAnnotation(
              output_qspec=act_qspec,
              _annotated=True,
          )
      return annotated_partitions
  
imports: import itertools
  import operator
  from dataclasses import dataclass
  from typing import Callable, Dict, List, NamedTuple, Optional
  import torch
  import torch.nn.functional
  from torch._subclasses import FakeTensor
  from torch.ao.quantization.fx.utils import get_new_attr_name_with_prefix
  from torch.ao.quantization.pt2e.graph_utils import find_sequential_partitions
  from torch.ao.quantization.pt2e.utils import _conv1d_bn_example_inputs, _conv2d_bn_example_inputs, get_aten_graph_module
  from torch.ao.quantization.quantizer import QuantizationAnnotation, QuantizationSpec, QuantizationSpecBase, SharedQuantizationSpec
  from torch.ao.quantization.quantizer.utils import _annotate_input_qspec_map, _annotate_output_qspec
  from torch.fx import Node
  from torch.fx.passes.utils.matcher_with_name_node_map_utils import SubgraphMatcherWithNameNodeMap
  from torch.fx.passes.utils.source_matcher_utils import get_source_partitions
label_desc: Use image node_id 16 for calling a global function with example usage: _annotate_max_pool2d(gm, quantization_config, filter_fn) and returns: annotated_partitions