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

我用了tf_geometric 给的例子,但是显示 TypeError: 'int' object is not subscriptable #51

Open
Dr-Yan78 opened this issue Mar 21, 2024 · 0 comments

Comments

@Dr-Yan78
Copy link

Dr-Yan78 commented Mar 21, 2024

coding=utf-8

import numpy as np
import tf_geometric as tfg
import tensorflow as tf

graph = tfg.Graph(
x=np.random.randn(5, 20), # 5 nodes, 20 features,
edge_index=[[0, 0, 1, 3],
[1, 2, 2, 1]] # 4 undirected edges
)

print("Graph Desc: \n", graph)

graph.to_directed(inplace=True) # pre-process edges
print("Processed Graph Desc: \n", graph)
print("Processed Edge Index:\n", graph.edge_index)

Multi-head Graph Attention Network (GAT)

gat_layer = tfg.layers.GAT(units=4, num_heads=4, activation=tf.nn.relu)
output = gat_layer([graph.x,graph.edge_index])
print("Output of GAT: \n", output)


显示,错误TypeError: 'int' object is not subscriptable

附上所使用的库版本:
tensorflow -------2.16.1
scipy ---------- 1.12.0

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

1 participant