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

Spektral 1.3.1 GCN Call Exception #453

Open
jm6898 opened this issue May 24, 2024 · 4 comments
Open

Spektral 1.3.1 GCN Call Exception #453

jm6898 opened this issue May 24, 2024 · 4 comments

Comments

@jm6898
Copy link

jm6898 commented May 24, 2024

from spektral.layers import GCNConv
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Input, Dropout
from spektral.datasets import citation

#Spektral package version == 1.3.1

#Trying to run a GCN model but following exception error showed up when run e.g.

GCNConv(16, 'relu')([X_in, A_in])


RuntimeError: Exception encountered when calling GCNConv.call().

Could not automatically infer the output shape / dtype of 'gcn_conv_3' (of type GCNConv). Either the GCNConv.call() method is incorrect, or you need to implement the GCNConv.compute_output_spec() / compute_output_shape() method. Error encountered:

Tried to convert 'y' to a tensor and failed. Error: None values not supported.

@ByeongJu-Kang
Copy link

I also get the same error..

I use ARMAConv layer.
The code that was working well before suddenly produces the same error with you.


ValueError Traceback (most recent call last)
in <cell line: 1>()
----> 1 graph_conv_1 = spektral.layers.ARMAConv(channels = 2000, activation = 'elu')([H_in, A_in])
2
3 graph_conv_2 = spektral.layers.ARMAConv(channels = 200,
4 activation = 'elu')([graph_conv_1, A_in])
5

2 frames
/usr/local/lib/python3.10/dist-packages/spektral/layers/convolutional/arma_conv.py in call(self, inputs, mask)
142
143 if mask is not None:
--> 144 output *= mask[0]
145 output = self.activation(output)
146

ValueError: Exception encountered when calling ARMAConv.call().

**Could not automatically infer the output shape / dtype of 'arma_conv' (of type ARMAConv). Either the ARMAConv.call() method is incorrect, or you need to implement the ARMAConv.compute_output_spec() / compute_output_shape() method. Error encountered:

Tried to convert 'y' to a tensor and failed. Error: None values not supported.**

Arguments received by ARMAConv.call():
• args=(['<KerasTensor shape=(None, 5), dtype=float32, sparse=None, name=keras_tensor_1>', '<KerasTensor shape=(None, 2808), dtype=float32, sparse=None, name=keras_tensor>'],)
• kwargs={'mask': ['None', 'None']}

When using spektral version 1.0.3, it works as before, but is very slow.
Therefore, I think there is currently a problem with spektral 1.3.0 and 1.3.1
(I also tried 1.3.0 but got the same error)

I'm waiting for error resolution.

@pppxiyu
Copy link

pppxiyu commented Sep 9, 2024

I have the same issue when using GCNConv.

@Mattiads1
Copy link

I get the same error, and after some work i found the solution:
import os
os.environ['TF_USE_LEGACY_KERAS'] = '1'

ate the begining of the code

I installed also tf_keras with: pip install tf-keras
I dont know if it os necessary

@chiniu-xia
Copy link

我收到相同的错误,经过一些工作,我找到了解决方案:import os os.environ['TF_USE_LEGACY_KERAS'] = '1'

吃掉代码的开头

我还安装了tf_keras:pip install tf-keras,我不知道它是否必要

这个方法试过了,没有用,求问各位大佬怎么解决的

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

5 participants