@Test
    public void testSlice1() throws ParseException {
        Tensor x = evaluate("tensor(d0[2],d1[4]):[ [1,2,3,4],[5,6,7,8] ]");
        AttributeConverter attributes = createAttributes().
                attr("starts", new int[] {1, 0}).
                attr("ends", new int[] {2, 3}).
                attr("axes", new int[] {0, 1}).build();
        assertEval("slice", x, evaluate("tensor(d0[1],d1[3]):[ [5,6,7] ]"), attributes);

        attributes = createAttributes().
                attr("starts", new int[] {0, 1}).
                attr("ends", new int[] {-1, 1000}).build();
        assertEval("slice", x, evaluate("tensor(d0[1],d1[3]):[ [2,3,4] ]"), attributes);

        attributes = createAttributes().
                attr("starts", new int[] {0, 1}).
                attr("ends", new int[] {3, 2}).
                attr("axes", new int[] {1, 0}).build();  // axes are switched
        assertEval("slice", x, evaluate("tensor(d0[1],d1[3]):[ [5,6,7] ]"), attributes);

        attributes = createAttributes().
                attr("starts", new int[] {1, 0}).
                attr("ends", new int[] {2, 3}).
                attr("axes", new int[] {0, -1}).build();  // negative axes
        assertEval("slice", x, evaluate("tensor(d0[1],d1[3]):[ [5,6,7] ]"), attributes);

        attributes = createAttributes().
                attr("starts", new int[] {1}).
                attr("ends", new int[] {2}).
                attr("axes", new int[] {0}).build();  // axis 1 is not specified
        assertEval("slice", x, evaluate("tensor(d0[1],d1[4]):[ [5,6,7,8] ]"), attributes);

        attributes = createAttributes().
                attr("starts", new int[] {0}).
                attr("ends", new int[] {1}).build();
        assertEval("slice", x, evaluate("tensor(d0[1],d1[4]):[ [1,2,3,4] ]"), attributes);
    }
Unit tests for ONNX operators. The number on the test reflects the minimum
opset number for the operations tested.

@author lesters
model-integration/src/test/java/ai/vespa/rankingexpression/importer/onnx/OnnxOperationsTestCase.java