code: def test_crop_and_resize(
      self, target, dev, executor_kind, layout, interpolate_method
  ):
      target_kind = tvm.target.Target(target).kind.name
      if (
          target_kind == "vulkan"
          and layout == "NHWC"
          and interpolate_method == "nearest_neighbor"
      ):
          pytest.xfail("Known failing case for these parameters")
  
      extrapolation_value = 0.0
  
      np.random.seed(0)
  
      eps = 1e-4
  
      if layout == "NHWC":
          img_shape = (10, 224, 224, 3)
          boxes = np.random.uniform(size=(2, 4)).astype("float32")
          box_indices = np.array([1, 0]).astype("int32")
          crop_size = np.array([20, 30]).astype("int32")
      elif layout == "NCHW":
          img_shape = (5, 3, 255, 255)
          boxes = np.random.uniform(size=(2, 4)).astype("float32")
          box_indices = np.array([0, 1]).astype("int32")
          crop_size = np.array([30, 30]).astype("int32")
      else:
          raise ValueError(f"Unknown layout: {layout}")
  
      image_data = np.random.uniform(size=img_shape).astype("float32")
  
      ref_res = tvm.topi.testing.crop_and_resize_python(
          image_data,
          boxes,
          box_indices,
          crop_size,
          layout,
          interpolate_method,
          extrapolation_value,
      )
  
      img = relay.var("img", relay.TensorType(img_shape, "float32"))
      bx = relay.var("bx", relay.TensorType(boxes.shape, "float32"))
      bx_idx = relay.var(
          "bx_idx", relay.TensorType(box_indices.shape, "int32")
      )
  
      z = relay.image.crop_and_resize(
          img,
          bx,
          bx_idx,
          list(crop_size),
          layout,
          interpolate_method,
          extrapolation_value,
      )
      zz = run_infer_type(z)
      assert zz.checked_type == relay.TensorType(
          ref_res.shape, "float32"
      )
      func = relay.Function([img, bx, bx_idx], z)
  
      op_res = relay.create_executor(
          executor_kind, device=dev, target=target
      ).evaluate(func)(image_data, boxes, box_indices)
      tvm.testing.assert_allclose(
          op_res.numpy(), ref_res, rtol=1e-3, atol=1e-04
      )
  
imports: import math
  import platform
  import sys
  import numpy
  import pytest
  import tvm
  import tvm.testing
  import tvm.topi.testing
  from tvm import relay, te
  from tvm.relay.testing import run_infer_type
label_desc: Use image node_id 1 for calling the TestCropAndResize obj's underlying member method code with example usage: obj.test_crop_and_resize(target, dev, executor_kind, layout, interpolate_method) without return types