Cannot read the array length because "inputsForOp" is null

This issue mark fixed at #9145 and # 9744, but the exception still exists in M2.1

exception in M2:
java.lang.NullPointerException: Cannot load from object array because “inputsForOp” is null
at org.nd4j.linalg.api.ops.impl.layers.recurrent.LSTMLayer.configureWithSameDiff(LSTMLayer.java:210)
at org.nd4j.autodiff.samediff.SameDiff.fromFlatBuffers(SameDiff.java:5503)
at org.nd4j.autodiff.samediff.SameDiff.fromFlatFile(SameDiff.java:5359)
at org.nd4j.autodiff.samediff.SameDiff.load(SameDiff.java:5250)
at org.nd4j.autodiff.listeners.checkpoint.CheckpointListener.loadCheckpoint(CheckpointListener.java:407)

exception in M2.1:
java.lang.NullPointerException: Cannot read the array length because “inputsForOp” is null
at org.nd4j.linalg.api.ops.impl.layers.recurrent.LSTMLayer.configureWithSameDiff(LSTMLayer.java:210)
at org.nd4j.autodiff.samediff.SameDiff.fromFlatBuffers(SameDiff.java:6058)
at org.nd4j.autodiff.samediff.SameDiff.fromFlatFile(SameDiff.java:5914)
at org.nd4j.autodiff.samediff.SameDiff.load(SameDiff.java:5805)
at org.nd4j.autodiff.listeners.checkpoint.CheckpointListener.loadCheckpoint(CheckpointListener.java:407)
at org.nd4j.autodiff.listeners.checkpoint.CheckpointListener.loadLastCheckpoint(CheckpointListener.java:417)

@SidneyLann do you have the model?

I sent you my project before, it contains the model. Or you can remove the old model and change it to use M2.1 and train several minutes and then get a model. thanks.

@SidneyLann let me see if this does it: Fixes #9756 by agibsonccc · Pull Request #9757 · deeplearning4j/deeplearning4j · GitHub In my tests everything ran. Not sure what the difference was. Part of it was also just some changes not being committed properly (likely a botched pull request merge)

Sorry for the confusion. I’ll do another point release to address this.

OK. Thank you for your help!

This issue still exists.
java.lang.NullPointerException: Cannot load from object array because “inputsForOp” is null
at org.nd4j.linalg.api.ops.impl.layers.recurrent.LSTMLayer.configureWithSameDiff(LSTMLayer.java:210)
at org.nd4j.autodiff.samediff.SameDiff.fromFlatBuffers(SameDiff.java:5503)
at org.nd4j.autodiff.samediff.SameDiff.fromFlatFile(SameDiff.java:5359)
at org.nd4j.autodiff.samediff.SameDiff.load(SameDiff.java:5250)
at org.nd4j.autodiff.listeners.checkpoint.CheckpointListener.loadCheckpoint(CheckpointListener.java:407)
at org.nd4j.autodiff.listeners.checkpoint.CheckpointListener.loadLastCheckpoint(CheckpointListener.java:417)

@SidneyLann what version are you using? If you look straight at the source this is impossible. We do a null check right here:

@SidneyLann edit: I downloaded the source for M2.1. It appears that’s still in there. It’s already fixed in master so I guess just use snapshots. I’ll be doing another release soon anyways after checking one more issue.


image

I can’t download new jar, the pom setting is not correct?

@SidneyLann that’s the old sonatype host. You need to use s01.oss.sonatype.org now.

Thanks. But NPE at this line now:
builder.peepholeWeights(sameDiff.getVariable(inputsForOp[inputsForOp.length - 1]));

java.lang.NullPointerException: Cannot read the array length because “inputsForOp” is null
at org.nd4j.linalg.api.ops.impl.layers.recurrent.LSTMLayer.configureWithSameDiff(LSTMLayer.java:205)

Need to check all references to inputsForOp.

@SidneyLann I wonder if this is actually burying a deeper problem somewhere…has peephole and those booleans are either wrong or the state configured there mismatches your parameters. Before we go out of our way adding null checks for everything I want to make sure that we’re not trying to just work around a problem somewhere else.

    if(inputsForOp != null && hasBiases) {
        builder.bias(sameDiff.getVariable(inputsForOp[3]));
    }

    if(inputsForOp != null && hasPH) {
        builder.peepholeWeights(sameDiff.getVariable(inputsForOp[inputsForOp.length - 1]));
    }

When I check like this, it can be trained and reloaded to train.

@SidneyLann I haven’t looked at this yet but the main thing I wanted to look at was to see if the neural network was imported correctly. There seems to be something off with variables being missing. I haven’t seen that a lot and want to make sure everything is correct.