145170ca9bbd89aa01d8a40841e3c039d3683af8,stellargraph/layer/graph_attention.py,GraphAttention,call,#GraphAttention#Any#,211

Before Change


        if kwargs.get("add_self_loops", False):
            // get the number of nodes from inputs[1] directly
            N = K.int_shape(inputs[1])[-1]
            if N is not None:
                // create self-loops
                A = tf.linalg.set_diag(A, K.cast(np.ones((N,)), dtype="float"))
            else:
                raise ValueError(
                    "{}: need to know number of nodes to add self-loops; obtained None instead".format(
                        type(self).__name__
                    )
                )

        outputs = []
        for head in range(self.attn_heads):
            kernel = self.kernels[head]  // W in the paper (F x F")
            attention_kernel = self.attn_kernels[

After Change


            dense += mask

            // Apply softmax to get attention coefficients
            dense = K.softmax(dense, axis=1)  // (N x N), Eq. 3 of the paper

            // Apply dropout to features and attention coefficients
            dropout_feat = Dropout(self.in_dropout_rate)(features)  // (N x F")
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: stellargraph/stellargraph
Commit Name: 145170ca9bbd89aa01d8a40841e3c039d3683af8
Time: 2019-06-03
Author: andrew.docherty@data61.csiro.au
File Name: stellargraph/layer/graph_attention.py
Class Name: GraphAttention
Method Name: call


Project Name: tensorflow/models
Commit Name: dfe2a43fb378b557f3dfc4315417afb291cd16b7
Time: 2018-09-25
Author: aman2930@gmail.com
File Name: official/mnist/mnist_tpu.py
Class Name:
Method Name: model_fn


Project Name: NifTK/NiftyNet
Commit Name: a1172cf54f3a14fb57e6b6405ce58f29ef543334
Time: 2017-08-24
Author: eli.gibson@gmail.com
File Name: niftynet/network/dense_vnet.py
Class Name: DenseVNet
Method Name: layer_op