Keras import : ClassCastException between layers.recurrent.LastTimeStep and layers.FeedForwardLayer


Issue Description

I am importing a Keras model that you can find on this colab using the follwing code :

// Import model
ComputationGraph model = KerasModelImport.importKerasModelAndWeights("/path/to/model.h5", true);

and it returns me

Exception in thread "main" java.lang.ClassCastException: class org.deeplearning4j.nn.conf.layers.recurrent.LastTimeStep cannot be cast to class org.deeplearning4j.nn.conf.layers.FeedForwardLayer (org.deeplearning4j.nn.conf.layers.recurrent.LastTimeStep and org.deeplearning4j.nn.conf.layers.FeedForwardLayer are in unnamed module of loader 'app')
	at org.deeplearning4j.nn.modelimport.keras.layers.recurrent.KerasLSTM.setWeights(
	at org.deeplearning4j.nn.modelimport.keras.utils.KerasModelUtils.importWeights(
	at org.deeplearning4j.nn.modelimport.keras.KerasModel.<init>(
	at org.deeplearning4j.nn.modelimport.keras.KerasModel.<init>(
	at org.deeplearning4j.nn.modelimport.keras.utils.KerasModelBuilder.buildModel(
	at org.deeplearning4j.nn.modelimport.keras.KerasModelImport.importKerasModelAndWeights(
	at org.lara.rnn.Main.main(

Version Information

  • Deeplearning4j version : 1.0.0-beta6
  • Platform information : Ubuntu 19.04 (64 Bits)
  • CUDA version : not used
  • NVIDIA driver version : not used

Additional Information

Where applicable, please also provide:

  • Full log or exception stack trace : see github issue
  • pom.xml : see github issue

I opened a GIthub issue here :

PS: I have the same results with SNAPSHOT from 06/05/2020