code: def legalize_qnn_for_dnnl(mod):
      """Transform qnn primitives to DNNL compatible form. Eliminate source zero point and apply
      strict sequence of post ops."""
      mod["main"] = rewrite(LegalizeQnnOpForDnnl(), mod["main"])
  
      seq = tvm.transform.Sequential(
          [
              transform.InferType(),
              # transform.SimplifyInference(),  # TODO: this pass decompose nn.layer_norm
              # transform.FoldScaleAxis(),  # TODO: fail inside TVM in case of grouped convolutions.
              transform.FoldConstant(),
          ]
      )
      with tvm.transform.PassContext(opt_level=3):
          mod = seq(mod)
      return mod
  
imports: import logging
  from functools import reduce
  import tvm.ir
  from tvm import relay
  from tvm.ir import Op
  from tvm.relay import expr
  from tvm.relay import transform
  from tvm.relay.analysis import analysis
  from tvm.relay.expr import Call, GlobalVar, TupleGetItem, const
  from tvm.relay.expr_functor import ExprMutator, ExprVisitor
  from ...None import _ffi_api
  from ...dataflow_pattern import DFPatternCallback, is_constant, is_expr, is_op, rewrite, wildcard
  from .register import register_pattern_table
label_desc: Use image node_id 31 for calling a global function with example usage: legalize_qnn_for_dnnl(mod) and returns: mod