微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决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 举报,一经查实,本站将立刻删除。