org.nd4j.linalg.dataset.api.iterator.MultiDataSetIterator Maven / Gradle / Ivy
The newest version!
/*
* ******************************************************************************
* *
* *
* * This program and the accompanying materials are made available under the
* * terms of the Apache License, Version 2.0 which is available at
* * https://www.apache.org/licenses/LICENSE-2.0.
* *
* * See the NOTICE file distributed with this work for additional
* * information regarding copyright ownership.
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* * License for the specific language governing permissions and limitations
* * under the License.
* *
* * SPDX-License-Identifier: Apache-2.0
* *****************************************************************************
*/
package org.nd4j.linalg.dataset.api.iterator;
import org.nd4j.linalg.dataset.api.MultiDataSet;
import org.nd4j.linalg.dataset.api.MultiDataSetPreProcessor;
import java.io.Serializable;
import java.util.Iterator;
public interface MultiDataSetIterator extends Iterator, Serializable {
/** Fetch the next 'num' examples. Similar to the next method, but returns a specified number of examples
*
* @param num Number of examples to fetch
*/
MultiDataSet next(int num);
/** Set the preprocessor to be applied to each MultiDataSet, before each MultiDataSet is returned.
* @param preProcessor MultiDataSetPreProcessor. May be null.
*/
void setPreProcessor(MultiDataSetPreProcessor preProcessor);
/**
* Get the {@link MultiDataSetPreProcessor}, if one has previously been set.
* Returns null if no preprocessor has been set
*
* @return Preprocessor
*/
MultiDataSetPreProcessor getPreProcessor();
/**
* Is resetting supported by this DataSetIterator? Many DataSetIterators do support resetting,
* but some don't
*
* @return true if reset method is supported; false otherwise
*/
boolean resetSupported();
/**
* Does this MultiDataSetIterator support asynchronous prefetching of multiple MultiDataSet objects?
* Most MultiDataSetIterators do, but in some cases it may not make sense to wrap this iterator in an
* iterator that does asynchronous prefetching. For example, it would not make sense to use asynchronous
* prefetching for the following types of iterators:
* (a) Iterators that store their full contents in memory already
* (b) Iterators that re-use features/labels arrays (as future next() calls will overwrite past contents)
* (c) Iterators that already implement some level of asynchronous prefetching
* (d) Iterators that may return different data depending on when the next() method is called
*
* @return true if asynchronous prefetching from this iterator is OK; false if asynchronous prefetching should not
* be used with this iterator
*/
boolean asyncSupported();
/**
* Resets the iterator back to the beginning
*/
void reset();
}