PetarV- / GAT

Graph Attention Networks (https://arxiv.org/abs/1710.10903)
https://petar-v.com/GAT/
MIT License
3.2k stars 644 forks source link

ValueError: Dimensions must be equal, but are 122904 and 12 for 'mul' (op: 'Mul') with input shapes: [122904], [12]. #60

Closed tanjia123456 closed 3 years ago

tanjia123456 commented 3 years ago

hello, @PetarV- @gcucurull I'm sorry to bother you again. I have 12 subject, every subject has 10242 nodes, 8 features, 76 classes. when I set the batch-size to 12, the error message appears: Traceback (most recent call last): File "execute_mindboggle.py", line 120, in loss = model.masked_softmax_cross_entropy(log_resh, lab_resh, msk_resh) File "/home/tj/codes/GAT_tensorflow/split_all_subject/GAT_master_5/models/base_gattn.py", line 47, in masked_softmax_cross_entropy loss = mask File "/home/tj/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py", line 812, in binary_op_wrapper return func(x, y, name=name) File "/home/tj/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py", line 1078, in _mul_dispatch return gen_math_ops.mul(x, y, name=name) File "/home/tj/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/gen_math_ops.py", line 5860, in mul "Mul", x=x, y=y, name=name) File "/home/tj/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 788, in _apply_op_helper op_def=op_def) File "/home/tj/anaconda3/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 507, in new_func return func(args, **kwargs) File "/home/tj/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3300, in create_op op_def=op_def) File "/home/tj/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1823, in init control_input_ops) File "/home/tj/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1662, in _create_c_op raise ValueError(str(e)) ValueError: Dimensions must be equal, but are 122904 and 12 for 'mul' (op: 'Mul') with input shapes: [122904], [12].

My task is still to classify nodes. Now the returned adj(12,10242,10242), features(12,10242,8), labels(12,10242,76), I don’t know if the problem is in layer.py or base_gattn.py and how to modify it? What's more, I alse want to know how to solve the memory error, If I have more subject, There will definitely be insufficient memory.

Looking forward to your reply! Your supporter