错误提示:

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

错误原因:

tensorflow版本的问题:

tensorflow1.0及以后api定义:(数字在后,tensors在前)

tf.stack(tensors, axis=axis)

For example:

t1 = [[1, 2, 3], [4, 5, 6]]
t2 = [[7, 8, 9], [10, 11, 12]]
tf.concat([t1, t2], 0) ==> [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]]
tf.concat([t1, t2], 1) ==> [[1, 2, 3, 7, 8, 9], [4, 5, 6, 10, 11, 12]]# tensor t3 with shape [2, 3]
# tensor t4 with shape [2, 3]
tf.shape(tf.concat([t3, t4], 0)) ==> [4, 3]
tf.shape(tf.concat([t3, t4], 1)) ==> [2, 6]

tensorflow之前版本(0.x版本:数字在前,tensors在后)

For example:

t1 = [[1, 2, 3], [4, 5, 6]]
t2 = [[7, 8, 9], [10, 11, 12]]
tf.concat(0,[t1, t2], 0)
tf.concat(1,[t1, t2], 1)

解决方法:

调整tf.concat函数中参数位置,tensors在前,数字在后

python TypeError: Expected int32, got list containing Tensors of type '_Message' instead.相关推荐

  1. Python 报错TypeError: expected string or bytes-like object

    问题描述:Python 中报错TypeError: expected string or bytes-like object 解决方法:根据报错上方的提示信息,大体猜测到可能出错的具体地方.出现该报错 ...

  2. TypeError: expected str, bytes or os.PathLike object, not module

    TypeError: expected str, bytes or os.PathLike object, not module 目录 TypeError: expected str, bytes o ...

  3. pip安装库包遇到错误:TypeError: expected str, bytes or os.PathLike object, not int 的解决方法

    1 问题描述 1.在安装python3的库包时候,遇到和os模块相关的错误:TypeError: expected str, bytes or os.PathLike object, not int, ...

  4. TypeError: expected str, bytes or os.PathLike object, not int(解决方法)

    在使用 pip 安装软件时,报错如下 $ pip install numpy Exception: Traceback (most recent call last):   File "/u ...

  5. Failed to include caffe_pb2, things might go wrong! ... TypeError: expected bytes, str found

    使用python的caffe的时候,出现下面的问题: Failed to include caffe_pb2, things might go wrong! Traceback (most recen ...

  6. 解决HuggingFace加载预训练模型时报错TypeError: expected str, bytes or os.PathLike object, not NoneType

    完整报错: TypeError: expected str, bytes or os.PathLike object, not NoneType 解决方法 检查下载的组件: 步骤1:完整的下载组件,包 ...

  7. Python TypeError: cat() takes no arguments

    Python TypeError: cat() takes no arguments 很少用class 结果今天一个简单的TypeError差点没弄疯 #!/uer/bin/env python3 c ...

  8. 解决 TypeError: expected string or bytes-like object

    报错如下: Traceback (most recent call last):File "*.py", line 37, in <module>html = get( ...

  9. TypeError: expected Tensor as element 0 in argument 0, but got numpy.ndarray解决办法

    TypeError: expected Tensor as element 0 in argument 0, but got numpy.ndarray 问题描述 原因分析: 需要Tensor变量,我 ...

最新文章

  1. 2022-2028年中国乙丙橡胶行业市场全景调查及投资潜力研究报告
  2. aws fargate_我如何在AWS Fargate上部署#100DaysOfCloud Twitter Bot
  3. 数据蒋堂 | 怎样生成有关联的测试数据
  4. 深入分析 Java I/O 的工作机制
  5. 【学习小记】一般图最大匹配——带花树算法
  6. VTK:Rendering之StippledLine
  7. linux程序设计知识点整理,笔试面试中C/C++重要知识点整理
  8. 在 VS Code 中轻松 review GitHub Pull Requests
  9. PEAR简介:用PEAR来写你的下一个php程序
  10. linux网卡聚合软件下载,linux网卡聚合
  11. 2.5D屏幕有什么好处?
  12. navicat如何导入sql文件和导出sql文件
  13. 应用统计学跟统计学_在实践中使用地统计学
  14. Hadoop学习之hdfs集群搭建详解
  15. 采用Xamarin进行ffmpeg调用视频编解码的方法
  16. Unknown column 'hghefsdhjd' in 'where clause'
  17. 五镜头无人机倾斜摄影POS编辑小程序
  18. 大数据学习——spark运营案例
  19. android 百度地图 itemizedoverlay,[008] 百度地图API之ItemizedOverlay的使用(Android)
  20. Apache Thrift 介绍

热门文章

  1. mysql select符合查询_数据库select group by 和having语句 多表连接查询 复合查询
  2. mysql 游标循环_mysql for循环遍历 游标用处
  3. golang runtime.findrunnable epoll_wait lock 占用CPU 过多排查
  4. 算法 求两个自然数的最小公倍数 C
  5. go语言学习(一)——go语言简介和环境搭建
  6. 利用Mininet进行VxLAN验证实验
  7. stm32f4 hs 电路_三相电路分析
  8. linux打理ftp用户,Linux中如何添加/删除FTP用户并设置权限
  9. 2021年古蔺高考成绩查询,古蔺中学2021录取分数线
  10. matlab编写长度为100矩形序列,18春[华中师范大学]华师《Matlab基础与应用》在线作业(100分)...