如何解决获取无效的参数:ValueError:输入包含NaN,无穷大或对于dtype'float32'而言太大的值
我遇到了以下错误
(0) Invalid argument: ValueError: Input contains NaN,infinity or a value too large for dtype('float32').
但是在输入中我已将dtype更改为int32,因为数据类型为int32,但我仍然是相同的错误。
用于特定输入的代码是
input1 = Input(shape=(pad_essay_idf.shape[1],),dtype='int32',name="essay_input")
embedding_layer_text = Embedding(vocab_size_text,300,weights=[embedding_matrix_idf],input_length=max_length_text_idf,trainable=False)(input1)
lstm1 = LSTM(300,activation='relu',return_sequences=True,kernel_initializer=keras.initializers.he_normal(seed=0))(embedding_layer_text)
flatten1 = Flatten()(lstm1)
我也有其他输入,但是只有此输入才出现此错误,否则我没有得到,请对此提供帮助。预先感谢
并且我还测试了我没有任何nan值,即使我将dtype更改为int32,我仍然收到float32消息
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com(将#修改为@)