code: def test_dyn_strided_slice():
      def verify(
          dshape,
          begin,
          end,
          strides,
          output,
          axes=None,
          ishape=None,
          slice_mode="end",
          test_ref=True,
          dtype="int32",
      ):
          ndim = len(dshape)
          begin = begin if begin else [0] * ndim
          end = end if end else list(dshape)
  
          # target numpy result
          x_data = np.random.uniform(size=dshape).astype("float32")
          ref_res = tvm.topi.testing.strided_slice_python(
              x_data, begin, end, strides, slice_mode, axes=axes
          )
  
          if ishape is None:
              ishape = (relay.Any(),) * ndim
  
          x = relay.var("x", relay.TensorType(ishape, "float32"))
          if strides:
              z = relay.strided_slice(
                  x,
                  begin=begin,
                  end=end,
                  strides=strides,
                  axes=axes,
                  slice_mode=slice_mode,
              )
          else:
              z = relay.strided_slice(
                  x,
                  begin=begin,
                  end=end,
                  axes=axes,
                  slice_mode=slice_mode,
              )
          func = relay.Function([x], z)
  
          func = run_infer_type(func)
          text = func.astext()
          assert "begin=" in text
          assert "end=" in text
  
          if not test_ref:
              return
          for target, dev in tvm.testing.enabled_targets():
              mod = tvm.ir.IRModule.from_expr(func)
              op_res = relay.create_executor(
                  "vm", mod=mod, device=dev, target=target
              ).evaluate()(x_data)
              tvm.testing.assert_allclose(op_res.numpy(), ref_res)
  
      verify(
          (1, 224, 224, 3),
          [0, 20, 20, 0],
          [1, 140, 140, 3],
          [1, 1, 1, 1],
          (1, 120, 120, 3),
          dtype="int64",
      )
      verify(
          (3, 4, 3),
          [1, 1, 0],
          [4, 4, 3],
          [2, 1, 1],
          (1, 3, 3),
          dtype="int16",
      )
      verify((3, 4, 3), [0, 0, 0], [4, -5, 4], [1, -1, 2], (3, 1, 2))
      verify((3, 4, 3), [1, 1, 0], [4, 4, 3], None, (2, 3, 3))
      verify((3, 4, 3), [1, 1, 0], [4, 1000, 3], None, (2, 3, 3))
      verify((3, 4, 3), [1, 1, 0], [4, 4, 4], None, (2, 3, 3))
      verify((3, 4, 3), [1, 1, 0], [4, 4, 3], None, (2, 3, 3))
      verify((3, 4, 3), [1, -1, 0], [4, -5, 3], [2, -1, 1], (1, 4, 3))
      verify((3, 4, 3), [1, -1, 0], [2, -3, 3], [1, -1, 1], (1, 2, 3))
      verify(
          (3, 4, 3),
          [1, 0, 0],
          [3, -1, 3],
          [1, 1, 1],
          (2, 4, 3),
          slice_mode="size",
          test_ref=False,
      )
      verify(
          (3, 4, 3),
          [1, 0, 0],
          [-1, 2, 3],
          [1, 1, 1],
          (2, 2, 3),
          slice_mode="size",
          test_ref=True,
      )
      verify(
          (3, 4, 3, 2),
          [1, 0],
          [3, 1],
          [1, 1],
          None,
          axes=[1, 3],
          ishape=(relay.Any(), 4, relay.Any(), 2),
      )
  
imports: import sys
  import numpy
  import numpy.random
  import pytest
  import tvm
  import tvm.testing
  import tvm.topi.testing
  from tvm import relay, te
  from tvm.relay import transform
  from tvm.relay.testing import run_infer_type
label_desc: Use image node_id 15 for calling a global function with example usage: test_dyn_strided_slice() without return types