code: def test_extract_constants_single():
      def _get_func():
          var_input = relay.var("data", shape=(10, 10), dtype="uint8")
          const_data = np.random.uniform(0, 255, (10, 10)).astype(
              "uint8"
          )
          const_input = relay.const(const_data, dtype="uint8")
          out = relay.add(var_input, const_input)
          func = relay.Function(relay.analysis.free_vars(out), out)
          func = run_opt_pass(func, relay.transform.InferType())
          return func, const_input
  
      def _expected():
          var_input1 = relay.var("data", shape=(10, 10), dtype="uint8")
          var_input2 = relay.var("p1", shape=(10, 10), dtype="uint8")
          out = relay.add(var_input1, var_input2)
          func = relay.Function(relay.analysis.free_vars(out), out)
          func = run_opt_pass(func, relay.transform.InferType())
          return func
  
      func, const = _get_func()
      new_func, const_dict = extract_constants(func)
      assert tvm.ir.structural_equal(new_func, _expected())
      assert 1 in const_dict
      assert (const_dict[1] == const.data.asnumpy()).all()
  
file_path: tvm/tests/python/contrib/test_ethosu/test_extract_constants.py
imports: import pytest
  import tvm
  from tvm import relay
  from tvm.relay.testing import run_opt_pass
  from tvm.relay.backend.contrib.ethosu.tir.compiler import extract_constants
  import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: test_extract_constants_single() and returns: func,  const_input, func