python报错:NotImplementedError: Cannot convert a symbolic Tensor报错与解决

报错:
NotImplementedError: Cannot convert a symbolic Tensor (sequential/simple_rnn/strided_slice:0) to a numpy array. This error may indicate that you’re trying to pass a Tensor to a NumPy call, which is not supported

查了其他大佬的tips,发现是numpy版本过高的问题,只要降低版本就可以。

其他博主是安装numpy~=1.19.5版本,但是因为我是Python3.8.0版本,因此直接重装了tensorflow。

pip install tensorflow-gpu~=2.4.1

然后keras和numpy也自动重装了,Keras~=2.4.3,numpy~=1.19.5。就没有再报错了。

 参考:https://blog.csdn.net/qq_34489091/article/details/121117702?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522166367265016782428656446%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=166367265016782428656446&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduend~default-1-121117702-null-null.142^v48^new_blog_pos_by_title,201^v3^control_1&utm_term=NotImplementedError%3A%20Cannot%20convert%20a%20symbolic%20Tensor%20%28lstm%2Fstrided_slice%3A0%29%20to%20a%20numpy%20array.%20This%20error%20may%20indicate%20that%20youre%20trying%20to%20pass%20a%20Tensor%20to%20a%20NumPy%20call%2C%20which%20is%20not%20supported&spm=1018.2226.3001.4187icon-default.png?t=M85Bhttps://blog.csdn.net/qq_34489091/article/details/121117702?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522166367265016782428656446%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=166367265016782428656446&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduend~default-1-121117702-null-null.142^v48^new_blog_pos_by_title,201^v3^control_1&utm_term=NotImplementedError%3A%20Cannot%20convert%20a%20symbolic%20Tensor%20%28lstm%2Fstrided_slice%3A0%29%20to%20a%20numpy%20array.%20This%20error%20may%20indicate%20that%20youre%20trying%20to%20pass%20a%20Tensor%20to%20a%20NumPy%20call%2C%20which%20is%20not%20supported&spm=1018.2226.3001.4187

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值