Hi!
I am trying to import a keras model created in Python. I am working with convolutional 3D layers which requires reshaping dense layer input into 5 dimensional shapes, however it does not seem that this is allowed by the reshape processor class?
The exception is:
Exception in thread “main” java.lang.UnsupportedOperationException: Cannot infer input type for reshape array [0, 60, 1, 3, 4]
The error is thrown in the following method in the ReshapePreprocessor class:
@Override
public InputType getOutputType(InputType inputType) throws InvalidInputTypeException {
long shape = getShape(this.targetShape, 0);
InputType ret;
switch (shape.length) {
case 2:
ret = InputType.feedForward(shape[1]);
break;
case 3:
RNNFormat format = RNNFormat.NCW;
if(this.format != null && this.format instanceof RNNFormat)
format = (RNNFormat)this.format;
ret = InputType.recurrent(shape[2], shape[1], format);
break;
case 4:
if (inputShape.length == 1 || inputType.getType() == InputType.Type.RNN) {
ret = InputType.convolutional(shape[1], shape[2], shape[3]);
} else {
CNN2DFormat cnnFormat = CNN2DFormat.NCHW;
if (this.format != null && this.format instanceof CNN2DFormat)
cnnFormat = (CNN2DFormat) this.format;
if (cnnFormat == CNN2DFormat.NCHW) {
ret = InputType.convolutional(shape[2], shape[3], shape[1], cnnFormat);
} else {
ret = InputType.convolutional(shape[1], shape[2], shape[3], cnnFormat);
}
}
break;
default:
throw new UnsupportedOperationException(
"Cannot infer input type for reshape array " + Arrays.toString(shape));
}
return ret;
}