遇到上述错误可能是由于没有将所有变量搬到GPU上去,你可以尝试这样做,并且一定要注意顺序
device = ('cuda' if .is_available() else 'cpu')
g, features, labels, mask = load_cora_data()
g = (device)
#注意这里顺序不能乱,g进行转换后再赋给GAT
net = GAT(g, in_dim=()[1], hidden_dim=8, out_dim=2, num_heads=8)
net = (device)
#下面这些变量同样需要进行转换
features = (device)
labels = (device)
mask = (device)