deeplearning4j/deeplearning4j

Sd.evaluate failure

adonnini opened this issue · 0 comments

When I run the code reported below, execution fails with

Index can't be < 0 and >= 1984

What am I missing / doing wrong? Thanks

CODE

String outputVariable = outReduced.name();                  
evaluation = new Evaluation();                  
testData.reset();                 
sd.evaluate(testData, outputVariable, evaluation);

outReduced has shape [64, 2, 31]

testData has 109 elements.

ERROR LOG

Exception in thread "main" java.lang.IllegalStateException: Index can't be < 0 and >= 1984 	at org.nd4j.linalg.factory.Nd4j.pullRows(Nd4j.java:4749) 	at org.nd4j.linalg.factory.Nd4j.pullRows(Nd4j.java:4722) 	at org.nd4j.evaluation.EvaluationUtils.extractNonMaskedTimeSteps(EvaluationUtils.java:208) 	at org.nd4j.evaluation.BaseEvaluation.reshapeAndExtractNotMasked(BaseEvaluation.java:186) 	at org.nd4j.evaluation.classification.Evaluation.eval(Evaluation.java:361) 	at org.nd4j.evaluation.BaseEvaluation.eval(BaseEvaluation.java:267) 	at org.nd4j.autodiff.samediff.SameDiff.evaluateHelper(SameDiff.java:2402) 	at org.nd4j.autodiff.samediff.SameDiff.evaluate(SameDiff.java:2296) 	at org.nd4j.autodiff.samediff.config.EvaluationConfig.exec(EvaluationConfig.java:197) 	at org.nd4j.autodiff.samediff.SameDiff.evaluate(SameDiff.java:2206) 	at org.deeplearning4j.examples.trajectorypredictiontransformer.LocationNextNeuralNetworkV7_04.fitAndEvaluateTestDataset(LocationNextNeuralNetworkV7_04.java:1083) 	at org.deeplearning4j.examples.trajectorypredictiontransformer.LocationNextNeuralNetworkV7_04.sameDiff3(LocationNextNeuralNetworkV7_04.java:685) 	at org.deeplearning4j.examples.trajectorypredictiontransformer.LocationNextNeuralNetworkV7_04.main(LocationNextNeuralNetworkV7_04.java:207)