w5688414
农民小飞侠
采纳率0%
2017-12-14 04:03 阅读 4.0k

repeatvector_2: expected ndim=2, found ndim=3

5

Traceback (most recent call last):
File "LSTM_att/co-attention.py", line 98, in
img_new_repeat = RepeatVector(maxlen)(img_new_dense)
File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 529, in call
self.assert_input_compatibility(x)
File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 469, in assert_input_compatibility
str(K.ndim(x)))
ValueError: Input 0 is incompatible with layer repeatvector_2: expected ndim=2, found ndim=3
求助,帮忙keras新手

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

2条回答 默认 最新

  • caozhy 从今以后生命中的每一秒都属于我爱的人 2017-12-14 04:08

    “Exception: Input 0 is incompatible with layer lstm_28: expected ndim=3, found ndim=2” ,出现这个错误,应该在当前层 的上一层中添加return_sequences=True这个参数,使其返回ndim=3的序列

    点赞 1 评论 复制链接分享
  • caozhy 从今以后生命中的每一秒都属于我爱的人 2017-12-14 15:45

    如果问题得到解决,麻烦点下我回答右边的采纳,谢谢

    点赞 评论 复制链接分享

相关推荐