@Test void testBuildWithSpecifiedIndexes() { List<TensorField> schema = List.of( new TensorField( "tensor_input", DataType.INTEGER, new int[]{-1, 2}, List.of( new TensorIndex("column1", 0), new TensorIndex("column2", 1) ) ) ); TensorIO input1 = new TensorIO( Map.of( "tensor_input", new Tensor( DataType.INTEGER, new int[]{3, 2}, new int[][]{ new int[]{1, 2}, new int[]{3, 4}, new int[]{5, 6} }) ) ); TensorIO input2 = new TensorIO( Map.of( "column1", new Tensor(DataType.INTEGER, new int[]{3}, new int[]{1, 3, 5}), "column2", new Tensor(DataType.INTEGER, new int[]{3}, new int[]{2, 4, 6}) ) ); TensorIO output1NoSimp = new TensorIOIntoTensorIO(schema, true).build(input1); TensorIO output2NoSimp = new TensorIOIntoTensorIO(schema, true).build(input2); for (TensorIO output : List.of(output1NoSimp, output2NoSimp)) { assertEquals(2, output.getTensors().size()); assertEquals(DataType.INTEGER, output.getTensor("column1").getType()); assertEquals(DataType.INTEGER, output.getTensor("column2").getType()); assertArrayEquals(new int[]{3}, output.getTensor("column1").getShape().getArrayShape()); assertArrayEquals(new int[]{3}, output.getTensor("column2").getShape().getArrayShape()); assertArrayEquals(new int[]{1, 3, 5}, (int[]) output.getTensor("column1").getData()); assertArrayEquals(new int[]{2, 4, 6}, (int[]) output.getTensor("column2").getData()); } output1NoSimp = new TensorIOIntoTensorIO(schema, false).build(input1); output2NoSimp = new TensorIOIntoTensorIO(schema, false).build(input2); for (TensorIO output : List.of(output1NoSimp, output2NoSimp)) { assertEquals(1, output.getTensors().size()); assertEquals(DataType.INTEGER, output.getTensor("tensor_input").getType()); assertArrayEquals(new int[]{3, 2}, output.getTensor("tensor_input").getShape().getArrayShape()); assertArrayEquals(new int[][]{ new int[]{1, 2}, new int[]{3, 4}, new int[]{5, 6}, }, (int[][]) output.getTensor("tensor_input").getData()); } }
@Override public TensorIO build(TensorIO input) throws EvaluationException { Map<String, Tensor> outputMap; if (this.buildIndexes) { outputMap = this.buildIndexes(input); } else { outputMap = this.buildMain(input); } return new TensorIO(outputMap); }
TensorIOIntoTensorIO implements Builder<TensorIO, TensorIO> { @Override public TensorIO build(TensorIO input) throws EvaluationException { Map<String, Tensor> outputMap; if (this.buildIndexes) { outputMap = this.buildIndexes(input); } else { outputMap = this.buildMain(input); } return new TensorIO(outputMap); } }
TensorIOIntoTensorIO implements Builder<TensorIO, TensorIO> { @Override public TensorIO build(TensorIO input) throws EvaluationException { Map<String, Tensor> outputMap; if (this.buildIndexes) { outputMap = this.buildIndexes(input); } else { outputMap = this.buildMain(input); } return new TensorIO(outputMap); } TensorIOIntoTensorIO(List<? extends TensorField> tensorFields);  TensorIOIntoTensorIO(List<? extends TensorField> tensorFields, boolean buildIndexes);  TensorIOIntoTensorIO(
        List<? extends TensorField> tensorFields,
        boolean buildIndexes,
        int rollingWindowsSize); }
TensorIOIntoTensorIO implements Builder<TensorIO, TensorIO> { @Override public TensorIO build(TensorIO input) throws EvaluationException { Map<String, Tensor> outputMap; if (this.buildIndexes) { outputMap = this.buildIndexes(input); } else { outputMap = this.buildMain(input); } return new TensorIO(outputMap); } TensorIOIntoTensorIO(List<? extends TensorField> tensorFields);  TensorIOIntoTensorIO(List<? extends TensorField> tensorFields, boolean buildIndexes);  TensorIOIntoTensorIO(
        List<? extends TensorField> tensorFields,
        boolean buildIndexes,
        int rollingWindowsSize); @Override TensorIO build(TensorIO input); }
TensorIOIntoTensorIO implements Builder<TensorIO, TensorIO> { @Override public TensorIO build(TensorIO input) throws EvaluationException { Map<String, Tensor> outputMap; if (this.buildIndexes) { outputMap = this.buildIndexes(input); } else { outputMap = this.buildMain(input); } return new TensorIO(outputMap); } TensorIOIntoTensorIO(List<? extends TensorField> tensorFields);  TensorIOIntoTensorIO(List<? extends TensorField> tensorFields, boolean buildIndexes);  TensorIOIntoTensorIO(
        List<? extends TensorField> tensorFields,
        boolean buildIndexes,
        int rollingWindowsSize); @Override TensorIO build(TensorIO input);  }