Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: Shape must be rank 2 but is rank 3 for 'gcn/GCN-0/relation_prototype_scope/MatMul' (op: 'MatMul') with input shapes: [2,4755,768], [768,1]. #22

Open
hhhmmmzzz opened this issue Mar 12, 2021 · 3 comments

Comments

@hhhmmmzzz
Copy link

我在跑模型的时候遇到了一个这样的错误:
ValueError: Shape must be rank 2 but is rank 3 for 'gcn/GCN-0/relation_prototype_scope/MatMul' (op: 'MatMul') with input shapes: [2,4755,768], [768,1].
不知道还有没有同学遇到了,求解答,非常非常感谢啦!

@cxysteven
Copy link
Collaborator

检查一下数据,能否贴多一点信息

@hhhmmmzzz
Copy link
Author

我把tensorflow换成1.14.0之后就不报错啦,非常感谢!

@okcd00
Copy link

okcd00 commented Dec 27, 2021

对于 tensorflow 版本小于 1.14 的,可以试试修改 run_spellgcn.py 的 L308 报错位置:

if str(tf.__version__) < '1.14':
  # with tensorflow <1.14
  graph_weights = tf.tensordot(multi_graph_embs, w0, [[2], [0]]) / 3
  graph_weights = tf.nn.softmax(graph_weights, axis=0)
else:
  graph_weights = tf.matmul(multi_graph_embs, w0) / 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants