code: def test_partial_constant():
      """Test the subgraph with (const, var, const, var) arguments."""
      if not tvm.get_global_func("runtime.DNNLJSONRuntimeCreate", True):
          print("skip because DNNL codegen is not available")
          return
  
      dtype = "float32"
      ishape = (10, 10)
  
      in_1 = relay.var("in_1", shape=ishape, dtype=dtype)
      in_2 = relay.var("in_2", shape=ishape, dtype=dtype)
      in_3 = relay.var("in_3", shape=ishape, dtype=dtype)
      in_4 = relay.var("in_4", shape=ishape, dtype=dtype)
  
      add1 = relay.add(in_1, in_2)
      add2 = relay.add(add1, in_3)
      add3 = relay.add(add2, in_3)
      add4 = relay.add(add3, in_3)
  
      func = relay.Function([in_1, in_2, in_3, in_4], add4)
      ref_mod = tvm.IRModule.from_expr(func)
      ref_mod = relay.transform.InferType()(ref_mod)
  
      data1 = np.random.uniform(0, 1, ishape).astype(dtype)
      data3 = np.random.uniform(0, 1, ishape).astype(dtype)
  
      params = {
          "in_1": tvm.nd.array(data1, device=tvm.cpu(0)),
          "in_3": tvm.nd.array(data3, device=tvm.cpu(0)),
      }
      ref_mod["main"] = bind_params_by_name(ref_mod["main"], params)
  
      opt_pass = tvm.transform.Sequential(
          [
              transform.InferType(),
              transform.SimplifyInference(),
              transform.FoldConstant(),
              transform.FoldScaleAxis(),
              transform.AnnotateTarget("dnnl"),
              transform.MergeCompilerRegions(),
              transform.PartitionGraph(),
          ]
      )
  
      with tvm.transform.PassContext(
          opt_level=3, disabled_pass=["AlterOpLayout"]
      ):
          mod = opt_pass(ref_mod)
  
      data2 = np.random.uniform(0, 1, ishape).astype(dtype)
      data4 = np.random.uniform(0, 1, ishape).astype(dtype)
      check_result(
          mod,
          ref_mod,
          {"in_2": data2, "in_4": data4},
          (10, 10),
          tol=1e-5,
      )
  
imports: import os
  import sys
  import numpy
  import tvm
  import tvm.relay.op
  import tvm.relay.testing
  from tvm import relay, runtime
  from tvm.contrib import utils
  from tvm.relay import transform
  from tvm.relay.backend import te_compiler
  from tvm.relay.build_module import bind_params_by_name
  from tvm.relay.op.contrib.register import get_pattern_table
label_desc: Use image node_id 12 for calling a global function with example usage: test_partial_constant() without return types