Skip to content

Instantly share code, notes, and snippets.

@liweigu
Last active September 3, 2018 06:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liweigu/8af223c3e245775d11f276cfe26e28ef to your computer and use it in GitHub Desktop.
Save liweigu/8af223c3e245775d11f276cfe26e28ef to your computer and use it in GitHub Desktop.
error info:
java.lang.IllegalStateException: Expected rank 4 mask array for 2D CNN layers. Mask arrays for 2D CNN layers must have shape [batchSize,channels,X,Y] where X = (1 or activationsHeight) and Y = (1 or activationsWidth): Got rank 2 array with shape [60, 1]
at org.deeplearning4j.util.ConvolutionUtils.cnn2dMaskReduction(ConvolutionUtils.java:602)
at org.deeplearning4j.nn.layers.convolution.ConvolutionLayer.feedForwardMaskArray(ConvolutionLayer.java:473)
at org.deeplearning4j.nn.graph.vertex.impl.LayerVertex.feedForwardMaskArrays(LayerVertex.java:196)
at org.deeplearning4j.nn.graph.ComputationGraph.setLayerMaskArrays(ComputationGraph.java:3689)
at org.deeplearning4j.nn.graph.ComputationGraph.fitHelper(ComputationGraph.java:1115)
at org.deeplearning4j.nn.graph.ComputationGraph.fit(ComputationGraph.java:1097)
at org.deeplearning4j.nn.graph.ComputationGraph.fit(ComputationGraph.java:962)
code:
featuresMask = Nd4j.create(inputMask, new int[] { sampleCount, size });
(other code is unchanged in https://gist.github.com/liweigu/f0dafd8045d766b39c23e1b52938b2ac)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment