zl程序教程

您现在的位置是:首页 >  其他

当前栏目

TensorFlow版本带来的concat错误

2023-03-15 23:22:56 时间

错误提示:

TypeError: Expected int32, got list containing Tensors of type '_Message' instead.

错误说明:

根据提示知道代码中一行concat相关的代码。 是由于TensorFlow版本带来的错误。

在TensorFlow 1.0以前的版本(0.x)的API中,concat的参数是数字在前,tensors在后的:

tf.concat(3, net, name=name)

而在TensorFlow 1.0版本以后的API中,concat的参数是tensors在前,数字在后的:

tf.concat(net, 3, name=name)

因为参考的代码可能当时运行的TensorFlow版本与本机版本不同,所以有了问题。

解决方案:

根据错误提示找到对应代码行,把concat的参数调换一下顺序就可以成功运行了。

查看作者首页

参考:http://blog.csdn.net/zcf1784266476/article/details/71248799