简体   繁体   中英

Load weights of keras model with custom layers

I am trying to save the model and weights for the WGAN implementation found in

https://github.com/keras-team/keras-contrib/blob/master/examples/improved_wgan.py .

However, when we perform load_weights(...), it throws "axes don't match array" error. I tried to use the save model, load model with custom objects. But that throws the error too. Can anyone please help me to save the weights properly when we have a custom loss and custom layers in Keras?

If someone needs the solution, saving the model in yaml format and then the weights in h5 worked for me!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM