简体   繁体   中英

keras model prediction is nan after saving and loading

I trained a neural network with google colab.
I saved the neural network using joblib.dump()

I then loaded the model on my PC using joblib.load()

I made a prediction on the exact same sample, using the same model, on both colab and my PC. On colab, it has an output of [[0.51]] . On my pc, it has an output of [[nan]] .

The model summary reports that the architecture of the model is the same. I checked the weights of the model I loaded on my PC, and the model on colab, and the weights are the exact same.

Any ideas as to what I can do? Thank you.

Quick update: even if I change all of my inputs to zero, the prediction is still nan.

据我所知keras有自己的保存模型的功能比如model.save('file.h5') ,使用joblib库来保存sklearn模型。

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