code: def _register_quantization_unary_fusion():
      class UnaryAttr:
          def __init__(
              self, op_name: str, scalars_attr=None, algorithm_attr=None
          ):
              self.op_name = op_name
              self.scalars_attr = scalars_attr if scalars_attr else []
              self.algorithm_attr = (
                  algorithm_attr if algorithm_attr else ""
              )
  
      for original_pattern_output_dtype in [
          torch.float32,
          torch.bfloat16,
      ]:
          # QConv2d
          # Priority 1 to match: QConv2d Unary pattern with int8 output
          # If a pattern1 is a sub-set of pattern2, we should try to match pattern2 firstly.
          # For example: pattern1 is qconv_fp32 -> relu, pattern2 is qconv_fp32 -> relu -> quant
          conv_unary_replace_patterns = {
              UnaryAttr(
                  "none", [], ""
              ): generate_pattern_with_output_quant(
                  dequantize_qconv_pt2e_pattern,
                  dtype=original_pattern_output_dtype,
              ),
              UnaryAttr(
                  "relu", [], ""
              ): generate_pattern_with_output_quant(
                  generate_pattern_with_unary(
                      dequantize_qconv_pt2e_pattern, aten.relu.default
                  ),
                  dtype=original_pattern_output_dtype,
              ),
              UnaryAttr(
                  "hardtanh", [], ""
              ): generate_pattern_with_output_quant(
                  generate_pattern_with_unary(
                      dequantize_qconv_pt2e_pattern,
                      aten.hardtanh.default,
                  ),
                  dtype=original_pattern_output_dtype,
              ),
          }
  
          for (
              unary_attr,
              patterns,
          ) in conv_unary_replace_patterns.items():
              # Register qconv2d pattern for ExternKernel Lowering
              _register_quantized_conv_lowering(
                  patterns,
                  1,  # pass_number
                  torch.ops.onednn.qconv2d_pointwise,  # computation_op
                  None,  # output_dtype, None is the default value for int8 output
                  unary_attr,  # unary_attr
                  original_pattern_output_dtype=original_pattern_output_dtype,
              )
  
          # Priority 2 to match: QConv2d Unary pattern with fp32/bfloat16 output
          conv_unary_replace_float_out_patterns = {
              UnaryAttr("relu", [], ""): generate_pattern_with_unary(
                  dequantize_qconv_pt2e_pattern, aten.relu.default
              ),
              UnaryAttr(
                  "hardtanh", [], ""
              ): generate_pattern_with_unary(
                  dequantize_qconv_pt2e_pattern, aten.hardtanh.default
              ),
          }
  
          for (
              unary_attr,
              patterns,
          ) in conv_unary_replace_float_out_patterns.items():
              # Register qconv2d pattern for ExternKernel Lowering
              _register_quantized_conv_lowering(
                  patterns,
                  2,  # pass_number
                  torch.ops.onednn.qconv2d_pointwise,  # computation_op
                  original_pattern_output_dtype,  # output_dtype
                  unary_attr,  # unary_attr
                  original_pattern_output_dtype=original_pattern_output_dtype,
              )
  
          # QLinear
          # Priority 1 to match: QLinear Unary pattern with int8 output
          linear_unary_replace_patterns = {
              UnaryAttr(
                  "none", [], ""
              ): generate_pattern_with_output_quant(
                  qlinear_pt2e_pattern,
                  dtype=original_pattern_output_dtype,
              ),
              UnaryAttr(
                  "relu", [], ""
              ): generate_pattern_with_output_quant(
                  generate_pattern_with_unary(
                      qlinear_pt2e_pattern, aten.relu.default
                  ),
                  dtype=original_pattern_output_dtype,
              ),
          }
  
          for (
              unary_attr,
              patterns,
          ) in linear_unary_replace_patterns.items():
              _register_quantized_linear_lowering(
                  patterns,
                  1,  # pass_number
                  torch.ops.onednn.qlinear_pointwise,  # computation_op
                  None,  # output_dtype
                  unary_attr,  # unary_attr
                  original_pattern_output_dtype=original_pattern_output_dtype,
              )
  
          # Priority 2 to match: QLinear Unary pattern with FP32/BF16 output
          linear_unary_replace_float_out_patterns = {
              UnaryAttr("relu", [], ""): generate_pattern_with_unary(
                  qlinear_pt2e_pattern, aten.relu.default
              ),
          }
  
          for (
              unary_attr,
              patterns,
          ) in linear_unary_replace_float_out_patterns.items():
              _register_quantized_linear_lowering(
                  patterns,
                  2,  # pass_number
                  torch.ops.onednn.qlinear_pointwise,  # computation_op
                  original_pattern_output_dtype,  # output_dtype
                  unary_attr,  # unary_attr
                  original_pattern_output_dtype=original_pattern_output_dtype,
              )
  
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 14 for calling a global function with example usage: _register_quantization_unary_fusion() without return types