Java Code Examples for org.nd4j.linalg.dataset.api.iterator.CachingDataSetIterator#next()
The following examples show how to use
org.nd4j.linalg.dataset.api.iterator.CachingDataSetIterator#next() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CachingDataSetIteratorTest.java From nd4j with Apache License 2.0 | 6 votes |
private void assertPreProcessingGetsCached(int expectedNumberOfDataSets, DataSetIterator it, CachingDataSetIterator cachedIt, PreProcessor preProcessor) { assertSame(preProcessor, cachedIt.getPreProcessor()); assertSame(preProcessor, it.getPreProcessor()); cachedIt.reset(); it.reset(); while (cachedIt.hasNext()) { cachedIt.next(); } assertEquals(expectedNumberOfDataSets, preProcessor.getCallCount()); cachedIt.reset(); it.reset(); while (cachedIt.hasNext()) { cachedIt.next(); } assertEquals(expectedNumberOfDataSets, preProcessor.getCallCount()); }
Example 2
Source File: CachingDataSetIteratorTest.java From nd4j with Apache License 2.0 | 6 votes |
private void assertCachingDataSetIteratorHasAllTheData(int rows, int inputColumns, int outputColumns, DataSet dataSet, DataSetIterator it, CachingDataSetIterator cachedIt) { cachedIt.reset(); it.reset(); dataSet.setFeatures(Nd4j.zeros(rows, inputColumns)); dataSet.setLabels(Nd4j.ones(rows, outputColumns)); while (it.hasNext()) { assertTrue(cachedIt.hasNext()); DataSet cachedDs = cachedIt.next(); assertEquals(1000.0, cachedDs.getFeatureMatrix().sumNumber()); assertEquals(0.0, cachedDs.getLabels().sumNumber()); DataSet ds = it.next(); assertEquals(0.0, ds.getFeatureMatrix().sumNumber()); assertEquals(20.0, ds.getLabels().sumNumber()); } assertFalse(cachedIt.hasNext()); assertFalse(it.hasNext()); }
Example 3
Source File: CachingDataSetIteratorTest.java From deeplearning4j with Apache License 2.0 | 6 votes |
private void assertPreProcessingGetsCached(int expectedNumberOfDataSets, DataSetIterator it, CachingDataSetIterator cachedIt, PreProcessor preProcessor) { assertSame(preProcessor, cachedIt.getPreProcessor()); assertSame(preProcessor, it.getPreProcessor()); cachedIt.reset(); it.reset(); while (cachedIt.hasNext()) { cachedIt.next(); } assertEquals(expectedNumberOfDataSets, preProcessor.getCallCount()); cachedIt.reset(); it.reset(); while (cachedIt.hasNext()) { cachedIt.next(); } assertEquals(expectedNumberOfDataSets, preProcessor.getCallCount()); }
Example 4
Source File: CachingDataSetIteratorTest.java From deeplearning4j with Apache License 2.0 | 6 votes |
private void assertCachingDataSetIteratorHasAllTheData(int rows, int inputColumns, int outputColumns, DataSet dataSet, DataSetIterator it, CachingDataSetIterator cachedIt) { cachedIt.reset(); it.reset(); dataSet.setFeatures(Nd4j.zeros(rows, inputColumns)); dataSet.setLabels(Nd4j.ones(rows, outputColumns)); while (it.hasNext()) { assertTrue(cachedIt.hasNext()); DataSet cachedDs = cachedIt.next(); assertEquals(1000.0, cachedDs.getFeatures().sumNumber()); assertEquals(0.0, cachedDs.getLabels().sumNumber()); DataSet ds = it.next(); assertEquals(0.0, ds.getFeatures().sumNumber()); assertEquals(20.0, ds.getLabels().sumNumber()); } assertFalse(cachedIt.hasNext()); assertFalse(it.hasNext()); }