I am loading a collection of 5 lstm models and using them to predict values of a simulation. It is returning NaN for some of these values which while annoying I can assume that I messed something up. The weird part to me is that the values it is returning as NaN is random to an extent. These are 2 pictures of the exact same code ran 1 after another, the predicted values are the colored dots, as shown where the code begins to successfully start predicting values is random. The only part of the code related to Keras/tf is:

from tensorflow import keras

from tensorflow.keras.models import Model

model1 = keras.models.load_model(‘path/aRNNS1,10,20,1’)

model2 = keras.models.load_model(‘path/aRNNS2,10,20,5’)

model3 = keras.models.load_model(‘path/aRNNS3,10,20,1’)

model4 = keras.models.load_model(‘path/aRNNS4,10,20,1’)

model5 = keras.models.load_model(‘path/aRNNS5,10,20,1’)

and:

result1[i] = model1.predict(pred1.reshape((1, inputl, vary1)), verbose=0)

result2[i] = model2.predict(pred2.reshape((1, inputl, vary2)), verbose=0)

result3[i] = model3.predict(pred3.reshape((1, inputl, vary3)), verbose=0)

result4[i] = model4.predict(pred4.reshape((1, inputl, vary4)), verbose=0)

result5[i] = model5.predict(pred5.reshape((1, inputl, vary5)), verbose=0)

with inputl being the input length of the models and vary# being the number of inputs. I am quite sure that the values that I am inputing into the pred# arrays is consistent between runs. The entire code is ~1500 lines so I don’t want to subject anyone to it other than me, I can give any necessary lines if needed.

any help would be greatly appreciated <3

Hi @Bray

Welcome to the TensorFlow Forum!

Please provide us some more details on the issue as we need to understand the model architecture, what type of input values the model accepts and what input values you are putting for model prediction. Thank you.