TypeError: while_loop() got an unexpected keyword argument 'maximum_iterations'

转载自:https://blog.csdn.net/zyh2004883/article/details/84337872

错误:

TypeError: while_loop() got an unexpected keyword argument 'maximum_iterations'

参照https://blog.csdn.net/qq_27009517/article/details/83275846

重新安装keras

因为我的CUDA版本为CUDA8.0,所以tensorflow版本有限制,只能用1.4.0以下的版本

所以tensorflow-gpu=1.4.0

之前keras版本太高了,所以才会报以上错误

更新keras版本后,错误解决

pip install keras==2.1.2

# -*- coding: utf-8 -*- 
# @Time : 2019/7/1 8:17 
# @Author : ZXL 
# @Site :  
# @File : many_input_API.py 
# @Software: PyCharm

from keras.models import Model
from keras import layers
from keras import Input

text_vocabulary_size = 10000
question_vocabulary_size = 10000
answer_vocabulary_size = 500

text_input = Input(shape=(None,), dtype='int32', name='text')
embedded_text = layers.Embedding(64, text_vocabulary_size)(text_input)
encoded_text = layers.LSTM(32)(embedded_text)

question_input = Input(shape=(None,),dtype='int32',name='question')
embedded_question = layers.Embedding(32, question_vocabulary_size)(question_input)
encoded_question = layers.LSTM(16)(embedded_question)

concatenated = layers.concatenate([encoded_text, encoded_question],axis=-1)#两个输入处理结果联系起来

answer = layers.Dense(answer_vocabulary_size,activation='softmax')(concatenated)
model = Model([text_input, question_input], answer)#模型声明
model.compile(optimizer='rmsprop',loss='categorical_crossentropy',metrics=['acc'])#compile阶段

model.summary()

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值