-
-
Save tastyminerals/149a47c86747cae7bac9692bcd5e262c to your computer and use it in GitHub Desktop.
MultiDataSetIterator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// init DL4J seq readers | |
val seqWordsReader = new CSVSequenceRecordReader() | |
seqWordsReader.initialize(new FileSplit(new File(wordsFileSavePath))) | |
val seqFeatsReader = new CSVSequenceRecordReader() | |
seqFeatsReader.initialize(new FileSplit(new File(featsFileSavePath))) | |
val seqLabelsReader = new CSVSequenceRecordReader() | |
seqLabelsReader.initialize(new FileSplit(new File(labelsFileSavePath))) | |
// wrap the readers into multi iterator | |
val batchSize = 1 | |
val numOfClasses = 2 | |
val multiIter = new RecordReaderMultiDataSetIterator.Builder(batchSize) | |
.addSequenceReader("wordsReader", seqWordsReader) | |
.addSequenceReader("featsReader", seqFeatsReader) | |
.addSequenceReader("labelsReader", seqLabelsReader) | |
.addInput("wordsReader") | |
.addInput("featsReader") | |
.addOutputOneHot("labelsReader", 0, numOfClasses) | |
.build() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment