ValueError: The two structures don't have the same number of elements

会有一股神秘感。 提交于 2019-11-30 18:39:13

Hello I had the same problem, I tried to do this:

highest = tf.map_fn(lambda x : (-x, x), indices)

This gave me a similar error message:

ValueError: The two structures don't have the same number of elements.

First structure (1 elements): <dtype: 'int32'>

Second structure (2 elements): (<tf.Tensor 'map/while/Neg:0' shape=() dtype=int32>, <tf.Tensor 'map/while/TensorArrayReadV3:0' shape=() dtype=int32>)

I resolved this by making the dtypes explicit:

highest = tf.map_fn(lambda x : (-x, x), indices, dtype=(tf.int32, tf.int32))
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!