diff --git a/deeplearning4j-core/src/main/java/org/deeplearning4j/datasets/canova/SequenceRecordReaderDataSetIterator.java b/deeplearning4j-core/src/main/java/org/deeplearning4j/datasets/canova/SequenceRecordReaderDataSetIterator.java index a1b429d23c47..460d935f53c1 100644 --- a/deeplearning4j-core/src/main/java/org/deeplearning4j/datasets/canova/SequenceRecordReaderDataSetIterator.java +++ b/deeplearning4j-core/src/main/java/org/deeplearning4j/datasets/canova/SequenceRecordReaderDataSetIterator.java @@ -161,8 +161,9 @@ private DataSet nextSingleSequenceReader(int num){ if(minLength == maxLength){ for (int i = 0; i < listFeatures.size(); i++) { - featuresOut.tensorAlongDimension(i, 1, 2).assign(listFeatures.get(i)); - labelsOut.tensorAlongDimension(i, 1, 2).assign(listLabels.get(i)); + //Note: this TAD gives us shape [vectorSize,tsLength] whereas we need a [vectorSize,timeSeriesLength] matrix (that listFeatures contains) + featuresOut.tensorAlongDimension(i, 1, 2).permutei(1,0).assign(listFeatures.get(i)); + labelsOut.tensorAlongDimension(i, 1, 2).permutei(1,0).assign(listLabels.get(i)); } } else { featuresMask = Nd4j.ones(listFeatures.size(),maxLength); @@ -171,8 +172,10 @@ private DataSet nextSingleSequenceReader(int num){ INDArray f = listFeatures.get(i); int tsLength = f.size(0); - featuresOut.tensorAlongDimension(i, 1, 2).put(new INDArrayIndex[]{NDArrayIndex.interval(0, tsLength), NDArrayIndex.all()}, f); - labelsOut.tensorAlongDimension(i, 1, 2).put(new INDArrayIndex[]{NDArrayIndex.interval(0, tsLength), NDArrayIndex.all()}, listLabels.get(i)); + featuresOut.tensorAlongDimension(i, 1, 2).permutei(1,0) + .put(new INDArrayIndex[]{NDArrayIndex.interval(0, tsLength), NDArrayIndex.all()}, f); + labelsOut.tensorAlongDimension(i, 1, 2).permutei(1,0) + .put(new INDArrayIndex[]{NDArrayIndex.interval(0, tsLength), NDArrayIndex.all()}, listLabels.get(i)); for( int j=tsLength; j= lLen){ //Align labels with end of features (features are longer) - featuresOut.tensorAlongDimension(i, 1, 2) + featuresOut.tensorAlongDimension(i, 1, 2).permutei(1,0) .put(new INDArrayIndex[]{NDArrayIndex.interval(0, fLen), NDArrayIndex.all()}, f); - labelsOut.tensorAlongDimension(i, 1, 2) + labelsOut.tensorAlongDimension(i, 1, 2).permutei(1,0) .put(new INDArrayIndex[]{NDArrayIndex.interval(fLen-lLen, fLen), NDArrayIndex.all()}, l); for( int j=fLen; j