code: def copy_constants():
      """A simple planner which copies all constant data from FLASH -> SRAM.
  
      Returns
      -------
      planner : callable
          The planning function.
      """
  
      def _planner(cached_func, const_dict, sch):
          planned = set()  # type: ignore
  
          def _is_matmul(tensor):
              if tensor.name not in ["ethosu_conv2d"]:
                  return False
              a, b = tensor.op.input_tensors[0:2]
              return a.shape[1:3] == [1, 1] and b.shape[1:3] == [1, 1]
  
          def _visit(tensor, reader, lut):
              if tensor not in planned:
                  planned.add(tensor)
                  if (
                      isinstance(tensor.op, tvm.te.PlaceholderOp)
                      and tensor != lut
                  ):
                      # Find index of input using 'same_as' check to prevent equality
                      # ambiguity when encountering a scalar.
                      is_same = [
                          var.same_as(tensor)
                          for var in cached_func.inputs
                      ]
                      index = is_same.index(True)
                      # Along with constants, also skip for FullyConnected to correspond
                      # with Vela behavior
                      if index in const_dict and not _is_matmul(reader):
                          sch.cache_read(tensor, "global", [reader])
  
                  elif isinstance(tensor.op, tvm.te.ComputeOp):
                      if "lut" in tensor.op.attrs.keys():
                          lut = tensor.op.attrs["lut"]
                      for input_tensor in tensor.op.input_tensors:
                          _visit(input_tensor, tensor, lut)
  
          for output_tensor in cached_func.outputs:
              _visit(output_tensor, None, None)
  
      return _planner
  
file_path: tvm/python/tvm/relay/backend/contrib/ethosu/tir/scheduler.py
imports: import tvm
  from tvm.contrib.ethosu.cascader import Propagator
label_desc: Use image node_id 4 for calling a global function with example usage: copy_constants() and returns: _planner, unknown, False