code: def test_pattern_conv2d_with_non_cons_weights():
      for const_weights in (True, False):
          a = relay.var("a", shape=(2, 7, 8, 8), dtype=fp32)
          if const_weights:
              w = relay.const(
                  np.random.uniform(-10, 10, (8, 7, 3, 3)).astype(fp32)
              )
          else:
              w = relay.var("w", shape=(8, 7, 3, 3), dtype=fp32)
  
          res = relay.nn.conv2d(
              a,
              w,
              kernel_size=(3, 3),
              padding=(1, 1),
              channels=8,
              out_dtype=fp32,
          )
  
          mod = partition(res)
          use_bnns = (
              len(mod.get_global_vars()) == 2
          )  # GlobalVar: "main" and "bnns_0"
  
          assert use_bnns == const_weights
  
file_path: tvm/tests/python/contrib/test_bnns/test_conv2d_patterns.py
imports: import tvm
  from tvm import relay
  import numpy
  from tvm.relay.op.contrib.bnns import partition_for_bnns
label_desc: Use image node_id 5 for calling a global function with example usage: test_pattern_conv2d_with_non_cons_weights() without return types