@@ -0,0 +1,948 @@
+package org.deeplearning4j.spark.data;%0A%0Aimport org.apache.spark.api.java.function.FlatMapFunction;%0Aimport org.nd4j.linalg.dataset.DataSet;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.Iterator;%0Aimport java.util.List;%0A%0A/**%0A * Take an existing DataSet object, and split it into multiple DataSet objects with one example in each%0A *%0A * Usage:%0A * %3Cpre%3E%0A * %7B@code%0A *      RDD%3CDataSet%3E myBatchedExampleDataSets = ...;%0A *      RDD%3CDataSet%3E singleExamlpeDataSets = myBatchedExampleDataSets.mapPartitions(new SplitDataSets(batchSize));%0A * %7D%0A * %3C/pre%3E%0A *%0A * @author Alex Black%0A */%0Apublic class SplitDataSetsFunction implements FlatMapFunction%3CIterator%3CDataSet%3E,DataSet%3E %7B%0A    @Override%0A    public Iterable%3CDataSet%3E call(Iterator%3CDataSet%3E dataSetIterator) throws Exception %7B%0A        List%3CDataSet%3E out = new ArrayList%3C%3E();%0A        while(dataSetIterator.hasNext())%7B%0A            out.addAll(dataSetIterator.next().asList());%0A        %7D%0A        return out;%0A    %7D%0A%7D%0A

Add SplitDataSetsFunction for Spark