alibaba / euler

A distributed graph deep learning framework.
Apache License 2.0
2.89k stars 559 forks source link

GAT 只能用dense feature,AttEncoder里没有用到聚合? #234

Open AI-Friend opened 4 years ago

AI-Friend commented 4 years ago

AttEncoder的输出是 tf.reshape(out, [batch_size, self.out_dim]),out_dim默认是1,所以返回的 embedding是【batch_size,1】。而且AttenEncoder里没有用到Aggregator,这是为什么呢?

alinamimi commented 4 years ago

out_dim默认是1,用户是需要输入out_dim的。AttEncoder实现的时候是指使用了dense feature,如果要使用其他feature,可以参照shallowEncoder,自己加一下

AI-Friend commented 4 years ago

我看GAT没有使用AttEncoder,而是使用了att_head函数。与GAT论文的linear transformation相比, 函数里用了一维卷积,是有什么考虑吗? 最重要的地方 logits = f_1 + tf.transpose(f_2, [0, 2, 1]) 这里,f_2变化维度,然后与f_1相加,这里实在没看懂, 可以给解答下吗?(为了达到5个邻居都与self node的特征作对应目的?然后一次性softmax?) def att_head(self, seq, out_size, activation): seq_fts = tf.layers.conv1d(seq, out_size, 1, use_bias=False) f_1 = tf.layers.conv1d(seq_fts, 1, 1) f_2 = tf.layers.conv1d(seq_fts, 1, 1)
logits = f_1 + tf.transpose(f_2, [0, 2, 1]) coefs = tf.nn.softmax(tf.nn.leaky_relu(logits)) vals = tf.matmul(coefs, seq_fts) ret = tf.contrib.layers.bias_add(vals) return ret 谢谢,@alinamimi