这种错误是numpy数组的维度不匹配导致的。

 np.array([1,2,3,[4,5,6]])
 ValueError: setting an array element with a sequence.

在tensorflow里面写数组的时候可能遇到这种问题,
因为普通的python的list列表是支持(1,2,3,[4,5,6]])这种方式的。
但numpy里面不存在这种写法,也很好理解,因为numpy是做向量和矩阵运算的,上面的list无法做运算。
因此出现这种错误后,应该看看是否存在数组里面维度不一致的问题。

ValueError: setting an array element with a sequence.

GitHub 加速计划 / te / tensorflow
25
4
下载
一个面向所有人的开源机器学习框架
最近提交(Master分支:2 个月前 )
4f64a3d5 Instead, check for this case in `ResolveUsers` and `ResolveOperand`, by querying whether the `fused_expression_root` is part of the `HloFusionAdaptor`. This prevents us from stepping into nested fusions. PiperOrigin-RevId: 724311958 2 个月前
aa7e952e Fix a bug in handling negative strides, and add a test case that exposes it. We can have negative strides that are not just -1, e.g. with a combining reshape. PiperOrigin-RevId: 724293790 2 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐