code: def _annotate_linear(
      gm: torch.fx.GraphModule,
      quantization_config: Optional[QuantizationConfig],
      filter_fn: Optional[Callable[[Node], bool]] = None,
  ) -> Optional[List[List[Node]]]:
      annotated_partitions = []
      input_act_qspec = get_input_act_qspec(quantization_config)
      output_act_qspec = get_output_act_qspec(quantization_config)
      weight_qspec = get_weight_qspec(quantization_config)
      bias_qspec = get_bias_qspec(quantization_config)
      for node in gm.graph.nodes:
          if (
              node.op != "call_function"
              or node.target != torch.ops.aten.linear.default
          ):
              continue
          if filter_fn and not filter_fn(node):
              continue
          act_node = node.args[0]
          weight_node = node.args[1]
          bias_node = None
          if len(node.args) > 2:
              bias_node = node.args[2]
  
          if _is_annotated([node]) is False:  # type: ignore[list-item]
              _annotate_input_qspec_map(
                  node,
                  act_node,
                  input_act_qspec,
              )
              _annotate_input_qspec_map(
                  node,
                  weight_node,
                  weight_qspec,
              )
              nodes_to_mark_annotated = [node, weight_node]
              if bias_node:
                  _annotate_input_qspec_map(
                      node,
                      bias_node,
                      bias_qspec,
                  )
                  nodes_to_mark_annotated.append(bias_node)
              _annotate_output_qspec(node, output_act_qspec)
              _mark_nodes_as_annotated(nodes_to_mark_annotated)
              annotated_partitions.append(nodes_to_mark_annotated)
  
      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 8 for calling a global function with example usage: _annotate_linear(gm, quantization_config, filter_fn) and returns: annotated_partitions