tensorflow各版本间踩过的坑

这篇博客列举了在不同TensorFlow版本间遇到的问题及其解决办法,包括TypeError、ValueError以及AttributeError等,涉及函数参数类型不匹配、API名称改变等问题,并提供了相应的修复建议。
摘要由CSDN通过智能技术生成

问题一:TypeError: Expected int32, got list containing Tensors of type ‘_Message’ instead.

tensorflow 函数tf.cocat([fw,bw],2)出错:

Expected int32, got list containing Tensors of type ‘_Message’ inst
查看原因是11版本的函数形式为:tf.concat(2,[fw,bw]),即应把串联的维度与串联值位置调换即可.

问题二:Input ‘split_dim’ of ‘Split’ Op has type float32 that does not match expected type of int32

This is because in Tensorflow versions < 0.12.0 the split function takes the arguments as:

x = tf.split(0, n_steps, x) # tf.split(axis, num_or_size_splits, value)
The tutorial you are working from was written for versions > 0.12.0, which has been changed to be consistent with Numpy’s split syntax:

x = tf.split(x, n_steps, 0) # tf.split(value, num_or_size_splits, axis)

评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值