gpt4 book ai didi

python - 'y' Op 的输入 'Equal' 的 bool 类型与参数 'x' 的 float32 类型不匹配

转载 作者:行者123 更新时间:2023-12-05 02:06:15 26 4
gpt4 key购买 nike

我正在从事语音数字识别项目。

模型定义:

input_layer = Input(shape = (max_length, 1))      //Takes input vectors
input_mask = Input(shape = (max_length)) //Takes boolean mask vectors (False for zero else true)
LSTM_layer = LSTM(25)(input_layer, mask = input_mask)
dense = Dense(50, 'relu')(LSTM_layer)
dense_1 = Dense(10, 'softmax')(dense)
model = Model(inputs = [input_layer, input_mask], outputs = dense_1)

错误截图: enter image description here

最佳答案

我想通了。只需在两个输入层中指定数据类型,如下所示:

input_layer = Input(shape = (max_length, 1), dtype='float32')
input_mask = Input(shape = (max_length), dtype='bool')
LSTM_layer = LSTM(25)(input_layer, mask = input_mask)
dense = Dense(50, 'relu')(LSTM_layer)
dense_1 = Dense(10, 'softmax')(dense)
model = Model(inputs = [input_layer, input_mask], outputs = dense_1)

关于python - 'y' Op 的输入 'Equal' 的 bool 类型与参数 'x' 的 float32 类型不匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62839033/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com