code: def _get_linear_node(match, input_dim_exceeds_two, input_contiguous):
      output_reshape_node = None
      if input_dim_exceeds_two:
          if input_contiguous:
              output_reshape_node = match.output_node()
              assert output_reshape_node.target is aten.reshape.default
              linear_node = output_reshape_node.args[0]
          else:
              linear_nodes = filter_nodes(match.nodes, aten.bmm.default)
              assert len(linear_nodes) == 1
              linear_node = linear_nodes[0]
      else:
          linear_node = match.output_node()
  
      assert linear_node.target in (
          aten.addmm.default,
          aten.mm.default,
          aten.bmm.default,
      )
      return linear_node, output_reshape_node
  
imports: import copy
  import functools
  import itertools
  import math
  import operator
  from typing import Any, Tuple
  import torch
  from torch._dynamo.utils import counters
  from torch.fx.experimental.symbolic_shapes import has_free_symbols
  from ..lowering import lowerings, require_channels_last
  from ..pattern_matcher import Arg, CallFunction, filter_nodes, KeywordArg, ListOf, Match
  from ..utils import pad_listlike
  from .freezing_patterns import register_freezing_graph_pattern
  from .post_grad import register_lowering_pattern
label_desc: Use image node_id 31 for calling a global function with example usage: _get_linear_node(match, input_dim_exceeds_two, input_contiguous) and returns: linear_node,  output_reshape_node