code: def test_split_indices_legalize():
      def create_graph(axis):
          x = relay.var("x", shape=(1, 50, 50, 3))
          x_relu = relay.nn.relu(x)
          split_output = relay.split(
              x_relu, [5, 20, 45], axis
          ).tuple_value
          return relay.Function([x], split_output)
  
      def expected_mod_axis1():
          expected_ir_string = """
          #[version = "0.0.5"]
          def @tvmgen_default_ethos_u_main_0(%x: Tensor[(1, 50, 50, 3), float32]) -> (Tensor[(1, 5, 50, 3), float32],\
                                                                 Tensor[(1, 15, 50, 3), float32],\
                                                                 Tensor[(1, 25, 50, 3), float32],\
                                                                 Tensor[(1, 5, 50, 3), float32]) {
            %0 = nn.relu(%x) /* ty=Tensor[(1, 50, 50, 3), float32] */;
            %1 = strided_slice(%0, begin=[0, 0, 0, 0], end=[1, 5, 50, 3], strides=[1], axes=None)\
             /* ty=Tensor[(1, 5, 50, 3), float32] */;
            %2 = strided_slice(%0, begin=[0, 5, 0, 0], end=[1, 20, 50, 3], strides=[1], axes=None)\
             /* ty=Tensor[(1, 15, 50, 3), float32] */;
            %3 = strided_slice(%0, begin=[0, 20, 0, 0], end=[1, 45, 50, 3], strides=[1], axes=None)\
             /* ty=Tensor[(1, 25, 50, 3), float32] */;
            %4 = strided_slice(%0, begin=[0, 45, 0, 0], end=[1, 50, 50, 3], strides=[1], axes=None)\
             /* ty=Tensor[(1, 5, 50, 3), float32] */;
            (%1, %2, %3, %4)
          }
          """
          return tvm.relay.fromtext(expected_ir_string)
  
      def expected_mod_axis2():
          expected_ir_string = """
          #[version = "0.0.5"]
          def @tvmgen_default_ethos_u_main_0(%x: Tensor[(1, 50, 50, 3), float32]) -> (Tensor[(1, 50, 5, 3), float32],\
                                                                 Tensor[(1, 50, 15, 3), float32],\
                                                                 Tensor[(1, 50, 25, 3), float32],\
                                                                 Tensor[(1, 50, 5, 3), float32]) {
            %0 = nn.relu(%x) /* ty=Tensor[(1, 50, 50, 3), float32] */;
            %1 = strided_slice(%0, begin=[0, 0, 0, 0], end=[1, 50, 5, 3], strides=[1], axes=None)\
             /* ty=Tensor[(1, 50, 5, 3), float32] */;
            %2 = strided_slice(%0, begin=[0, 0, 5, 0], end=[1, 50, 20, 3], strides=[1], axes=None)\
             /* ty=Tensor[(1, 50, 15, 3), float32] */;
            %3 = strided_slice(%0, begin=[0, 0, 20, 0], end=[1, 50, 45, 3], strides=[1], axes=None)\
             /* ty=Tensor[(1, 50, 25, 3), float32] */;
            %4 = strided_slice(%0, begin=[0, 0, 45, 0], end=[1, 50, 50, 3], strides=[1], axes=None)\
             /* ty=Tensor[(1, 50, 5, 3), float32] */;
            (%1, %2, %3, %4)
          }
          """
          return tvm.relay.fromtext(expected_ir_string)
  
      rewrite_split = [
          legalize.PartitionedSplitRewriter(),
          legalize.SplitRewriter(),
      ]
  
      mod_axis1 = tvm.IRModule()
      func = create_graph(1)
      for r in rewrite_split:
          func = dataflow_pattern.rewrite(r, func)
      mod_axis1["tvmgen_default_ethos_u_main_0"] = func
      expected_axis1 = expected_mod_axis1()
      tvm.ir.assert_structural_equal(mod_axis1, expected_axis1)
  
      mod_axis2 = tvm.IRModule()
      func = create_graph(2)
      for r in rewrite_split:
          func = dataflow_pattern.rewrite(r, func)
      mod_axis2["tvmgen_default_ethos_u_main_0"] = func
      expected_axis2 = expected_mod_axis2()
      tvm.ir.assert_structural_equal(mod_axis2, expected_axis2)
  
imports: import pytest
  import math
  import numpy
  import tensorflow
  import tflite.Model
  import tvm
  from tvm import relay
  from tvm.relay.backend.contrib.ethosu import legalize, preprocess
  from tvm.relay import dataflow_pattern
  from tvm.relay.op.contrib import ethosu
  from tvm.relay.backend.contrib.ethosu import util, codegen
  from tvm.relay.build_module import bind_params_by_name
  from tvm.relay.frontend.tflite import get_pad_value
  from tvm.relay.expr_functor import ExprVisitor
  from .None import infra
label_desc: Use image node_id 3 for calling a global function with example usage: test_split_indices_legalize() and returns: relay, tvm, tvm