def METHOD_NAME(gm: torch.fx.GraphModule):
  modules_patterns = {
    (torch.nn.Conv1d, torch.nn.BatchNorm1d),
    (torch.nn.Conv2d, torch.nn.BatchNorm2d),
    (torch.nn.Conv3d, torch.nn.BatchNorm3d)
  }
  module_func_patterns = {
    (torch.nn.Conv1d, F.batch_norm),
    (torch.nn.Conv2d, F.batch_norm),
    (torch.nn.Conv3d, F.batch_norm)
  }
  modules = dict(gm.named_modules())
  for pattern in modules_patterns:
    for node in gm.graph.nodes:
      if matches_module_pattern(pattern, node, modules):
          if len(node.args[0].users) > 1:  # conv that has multiple consumers is ignored
              continue
          conv = modules[node.args[0].target]
          bn = modules[node.target]
          eval_mode = all(not n.training for n in [conv, bn])
          if not eval_mode:
              continue
          if not bn.track_running_stats:
              continue
          fused_conv = fuse_conv_bn_eval(conv, bn)
          replace_node_module(node.args[0], modules, fused_conv)
          node.replace_all_uses_with(node.args[0])
          gm.graph.erase_node(node)
          gm.graph.lint()
  for pattern in module_func_patterns:
    for node in gm.graph.nodes:
      if matches_module_function_pattern(pattern, node, modules):
        # TODO: support kwargs.
        if len(node.args) != 8:
            continue
        conv = modules[node.args[0].target]
        bn_training = node.args[5]
        bn_eps = node.args[7]
        if conv.training or bn_training:
            continue
        if type(bn_eps) is not float:
            continue
        bn_args_is_constant = all(
            n.op == "get_attr" and len(n.users) == 1 for n in node.args[1:5]
        )
        if not bn_args_is_constant:
            continue
        bn_running_mean = fetch_attr(node.args[1].target, gm)
        bn_running_var = fetch_attr(node.args[2].target, gm)
        bn_weight = fetch_attr(node.args[3].target, gm)
        bn_bias = fetch_attr(node.args[4].target, gm)
        if bn_running_mean is None or bn_running_var is None:
            continue
        fused_conv = copy.deepcopy(conv)
        fused_conv.weight, fused_conv.bias = fuse_conv_bn_weights(
            fused_conv.weight,
            fused_conv.bias,
            bn_running_mean,
            bn_running_var,
            bn_eps,
            bn_weight,
            bn_bias,
        )
        replace_node_module(node.args[0], modules, fused_conv)
        node.replace_all_uses_with(node.args[0])
        gm.graph.erase_node(node)
        gm.graph.lint()
  gm.recompile()
  return gm