tkipf / keras-gcn

Keras implementation of Graph Convolutional Networks
MIT License
791 stars 266 forks source link

Errors when testing the train.py with tensorflow as backend #26

Closed zhangyu2ustc closed 6 years ago

zhangyu2ustc commented 6 years ago

Hi, I was trying to test the keras-gcn package with the cora dataset. But there is always an error when I try to run the command: H = GraphConvolution(16, support, activation='relu', kernel_regularizer=l2(5e-4))([H]+G)

Output message: Loading cora dataset... Dataset has 2708 nodes, 5429 edges, 1433 features.

InvalidArgumentError: Dimensions must be equal, but are 4299 and 1433 for 'graph_convolution_2/MatMul' (op: 'MatMul') with input shapes: [?,4299], [1433,16].

The dataset has a shape of (2708, 1433) for input and (2708, 7) for output.

Do you have a clue what causes this error and how can I fix it ? My keras version is 2.1.1, with tensorflow (version 1.4.0) as backend.

Thanks! Best, Yu.

tkipf commented 6 years ago

Interesting- thanks for reporting. Did you make any changes to the code?

zhangyu2ustc commented 6 years ago

Thanks for the quick reply.

No, I did not make changes to the script, but the codes into jupyter-notebook for running. Is that a problem?

tkipf commented 6 years ago

Can you try running the script directly from the command line?

zhangyu2ustc commented 6 years ago

Sorry, I have errors during installation of the package: error: [Errno 5] Input/output error: '${HOME}/tensorflow/lib/python3.5/site-packages/kegra-0.0.1-py3.5.egg

This is probably due to the permission issues in our local clusters. That's why I want to test it using jupyter. Do you have any idea what might cause the problem of changing the dimensionality: [?,4299]

tkipf commented 6 years ago

I'm not sure how I can reproduce your error. But instead of installing the package you can also add the folder containing it to your PYTHONPATH environment variable, e.g. by running

export PYTHONPATH="~/code/keras-gcn/:$PYTHONPATH"

Simply replace ~/code/keras-gcn/ with the path where your package is located.

After the folder is added to your PYTHONPATH environment variable, you can run the model from your command line (without installing the package).

zhangyu2ustc commented 6 years ago

Thanks! It worked in this way!

zhangyu2ustc commented 6 years ago

The error message showed up again when I change the FILTER method from 'localpool' to 'chebyshev' even by running "python train.py" from terminal

ValueError: Dimensions must be equal, but are 4299 and 1433 for 'graph_convolution_1/MatMul' (op: 'MatMul') with input shapes: [?,4299], [1433,16].

tkipf commented 6 years ago

Ah, thanks for catching this - this is something I can look into.

tkipf commented 6 years ago

Fixed with https://github.com/tkipf/keras-gcn/commit/eb89564a0e865640c11283991685d80c84bc602a