python TypeError: Expected int32, got list containing Tensors of type '_Message' instead.
2018-01-28 18:17
525 查看
错误提示:
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在前,数字在后
相关文章推荐
- TypeError: Expected int32, got list containing Tensors of type '_Message' instead.
- TypeError: Expected int32, got list containing Tensors of type '_Message' instead.解决方法
- TypeError: Expected int32, got list containing Tensors of type '_Message' instead.
- TypeError: Expected int32, got list containing Tensors of type '_Message' instead.
- TypeError: Expected int32, got list containing Tensors of type '_Message' instead.
- Expected int32, got list containing Tensors of type '_Message' instead.
- tf.cocat Expected int32, got list containing Tensors of type '_Message' instead.
- TypeError: List of Tensors when single Tensor expected - when using const with tf.random_normal
- python list转换字符串报错TypeError: sequence item 0: expected str instance, int found
- python 点滴记录4:TypeError: range() integer end argument expected, got str.
- Expected put message. Got: ERROR (2072211)
- Android studio 2.3 打包版本,提示 Error: Expected resource of type styleable [ResourceType]
- 错误 Error: Expected resource of type id [ResourceTyp]
- python3环境下 tensorflow环境中经常遇到'*' has type str, but expected one of: bytes问题的解决
- Python出现: TypeError: expected string or buffer
- Android打包apk提示Error: Expected resource of type id [ResourceType]解决办法
- Error:Error: Expected resource of type drawable [ResourceType]
- TypeError: Input 'split_dim' of 'Split' Op has type float32 that does not match expected type of int
- python的TypeError: unhashable type(list/set/dict)问题
- [已解决]Error:Error: Expected resource of type string [ResourceType]