code: def test_meta_schedule_integration_extract_from_resnet_with_filter_func():
      @register_func(
          "relay.backend.tir_converter.remove_purely_spatial",
          override=True,
      )
      def filter_func(args, _) -> bool:
          from tvm.te import (
              create_prim_func,
          )  # pylint: disable=import-outside-toplevel
  
          has_complex_op = False
          visited = set()
  
          def traverse(t):
              nonlocal has_complex_op
              assert t.handle is not None
              if t.handle.value in visited:
                  return
              if isinstance(t.op, te.PlaceholderOp):
                  pass
              elif isinstance(t.op, te.ComputeOp):
                  has_complex_op = has_complex_op or any(
                      isinstance(e, tir.Reduce) for e in t.op.body
                  )
                  for x in t.op.input_tensors:
                      traverse(x)
              visited.add(t.handle.value)
  
          for t in args:
              traverse(t)
          if not has_complex_op:
              return None
          return create_prim_func(args)
  
      mod, params, _ = get_network(
          name="resnet_18", input_shape=[1, 3, 224, 224]
      )
      extracted_tasks = ms.relay_integration.extract_tasks(
          mod,
          target="llvm",
          params=params,
          pass_config={
              "relay.backend.use_meta_schedule": True,
              "relay.backend.tir_converter": "remove_purely_spatial",
          },
      )
      expected_task_names = [
          "fused_" + s
          for s in [
              "nn_max_pool2d",
              "nn_adaptive_avg_pool2d",
              "nn_dense_add",
              "nn_conv2d_add",
              "nn_conv2d_add_1",
              "nn_conv2d_add_2",
              "nn_conv2d_add_add_nn_relu",
              "nn_conv2d_add_add_nn_relu_1",
              "nn_conv2d_add_nn_relu",
              "nn_conv2d_add_nn_relu_1",
              "nn_conv2d_add_nn_relu_2",
              "nn_conv2d_add_nn_relu_3",
              "nn_conv2d_add_nn_relu_4",
              "nn_conv2d_add_nn_relu_5",
              "nn_contrib_conv2d_winograd_without_weight_transform_add_add_nn_relu",
              "nn_contrib_conv2d_winograd_without_weight_transform_add_add_nn_relu_1",
              "nn_contrib_conv2d_winograd_without_weight_transform_add_nn_relu",
              "nn_contrib_conv2d_winograd_without_weight_transform_add_nn_relu_1",
          ]
      ]
  
      assert len(extracted_tasks) == len(expected_task_names)
      for t in extracted_tasks:
          assert t.task_name in expected_task_names, t.task_name
  
imports: import platform
  import tempfile
  from typing import List
  import numpy
  import pytest
  import tvm
  import tvm.testing
  from tvm import IRModule
  from tvm import meta_schedule
  from tvm import relay, te, tir
  from tvm._ffi import register_func
  from tvm.contrib import graph_executor
  from tvm.ir.transform import PassContext
  from tvm.meta_schedule.database import TuningRecord, Workload
  from tvm.meta_schedule.testing.relay_workload import get_network
  from tvm.meta_schedule.testing.tlcbench import load_quantized_bert_base
  from tvm.meta_schedule.tune_context import _normalize_mod
  from tvm.script import tir
  from tvm.target import Target
label_desc: Use image node_id 6 for calling a global function with example usage: test_meta_schedule_integration_extract_from_resnet_with_filter_func() and returns: create_prim_func, None