Tensor 转换请求 dtype float32 for Tensor with dtype bool |在 LSTM 中添加掩码

问题描述

我希望在 LSTM 中添加我自己创建的掩码。这是我的代码

    input_seq = Input(shape=(max_length,1),name='input_layer')
    mask = Input(shape=(max_length,),name='mask_layer')
    
    lstm1 = LSTM(25,return_sequences=True)(inputs=input_seq,mask=mask)
    lstm2 = LSTM(25,return_sequences=True)(lstm1)
    dense1 = Dense(50,activation='relu')(lstm2)
    dense2 = Dense(10,activation='relu')(dense1)
    model=Model(inputs=[input_seq,mask],outputs=dense2)
    model.summary()

我收到以下错误

ValueError: Tensor 转换请求 dtype float32 for Tensor with dtype bool:

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)