code: def adaptiveavgpool2d_inference_rule(n: Node, module_instance):
      """
      The input and output sizes should be the same except for the last
      two dimensions taken from the input, which represent width and height
      """
      assert isinstance(n.args[0], Node)
      if n.args[0].type == Dyn and isinstance(n.type, TensorType):
          n.args[0].type = expand_to_tensor_dim(
              n.args[0].type, len(n.type.__args__)
          )
      if isinstance(n.args[0].type, TensorType):
          output_type = adaptiveavgpool2d_check(
              n.args[0].type, module_instance
          )
          n.type = get_greatest_upper_bound(n.type, output_type)
      return n.type
  
imports: from functools import reduce
  import torch
  import operator
  from torch.fx.tensor_type import Dyn, is_consistent, TensorType, is_more_precise
  from typing import Callable, Dict
  from torch.fx.node import Target, Node
  from torch.nn.modules.batchnorm import BatchNorm2d
  from torch.nn.modules.conv import Conv2d
  from torch.fx.experimental.refinement_types import Equality
  import itertools
  from torch.fx.experimental.unification import Var
  import sympy
label_desc: Use image node_id 20 for calling a global function with example usage: adaptiveavgpool2d_inference_rule(n, module_instance) and returns: n