Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jageshmaharjan/e7a7acac68a66ac4795092f34376354a to your computer and use it in GitHub Desktop.
Save jageshmaharjan/e7a7acac68a66ac4795092f34376354a to your computer and use it in GitHub Desktop.
The PR is shown below. Basically, i was trying to feed my input to LSTM cell, normalize and trying to feed the Convolution layer. And My stacktrace is shown below. I don't know where did i get it wrong.
MultiLayerConfiguration configuration = new NeuralNetConfiguration.Builder()
.updater(Updater.NESTEROVS).adamMeanDecay(0.9).adamVarDecay(0.999)
.regularization(true).l2(1e-5).optimizationAlgo(OptimizationAlgorithm.STOCHASTIC_GRADIENT_DESCENT)
.weightInit(WeightInit.XAVIER)
.convolutionMode(ConvolutionMode.Truncate)
.gradientNormalization(GradientNormalization.ClipElementWiseAbsoluteValue).gradientNormalizationThreshold(1.0)
.learningRate(2e-2)
.list()
.layer(0, new GravesBidirectionalLSTM.Builder()
.name("LSTMCell_1")
.nIn(vectorSize)
.activation(Activation.SIGMOID)
.nOut(100)
.build())
.layer(1, new DenseLayer.Builder()
.name("Normalization_layer")
.gradientNormalization(GradientNormalization.ClipL2PerParamType)
.nOut(100)
.build())
.layer(2, new ConvolutionLayer.Builder()
.kernelSize(5,1)
.stride(1,1)
.activation(Activation.SIGMOID)
.build())
.layer(3, new GlobalPoolingLayer.Builder()
.activation(Activation.RELU)
.build())
.layer(4, new OutputLayer.Builder()
.activation(Activation.SOFTMAX)
.nOut(2)
.build())
.inputPreProcessor(2, new FeedForwardToCnnPreProcessor(100,100,1))
.pretrain(false).backprop(true)
.build()
// MY STACKTRACE
Exception in thread "main" java.lang.IllegalStateException: Invalid input: expected FeedForward input of size 10000 = (d=1 * w=100 * h=100), got InputTypeFeedForward(100)
at org.deeplearning4j.nn.conf.preprocessor.FeedForwardToCnnPreProcessor.getOutputType
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment