예제 #1
0
    def __init__(self, A, **kwargs):
        D = nd.sum(A, axis=0)

        D_hat = D**-1
        D_hat = nd.diag(D_hat)

        A = D_hat * A
        super().__init__(A=A, **kwargs)
예제 #2
0
    def __init__(self, A, **kwargs):
        A_hat = A.copy() + nd.eye(*A.shape)
        D = nd.sum(A_hat, axis=0)

        D_hat = D**-0.5
        D_hat = nd.diag(D_hat)

        A_hat = D_hat * A_hat * D_hat
        super().__init__(A=A_hat, **kwargs)
예제 #3
0
파일: gcn2.py 프로젝트: shaolyy/learn-mxnet
 def __init__(self, A, in_units, out_units, activation='relu', **kwargs):
     super().__init__(**kwargs)
     I = nd.eye(*A.shape)
     A_hat = A.copy() + I
     D = nd.sum(A_hat, axis=0)
     D_inv = D**-0.5
     D_inv = nd.diag(D_inv)
     A_hat = D_inv * A_hat * D_inv
     self.in_units, self.out_units = in_units, out_units
     with self.name_scope():
         self.A_hat = self.params.get_constant('A_hat', A_hat)
         self.W = self.params.get('W',
                                  shape=(self.in_units, self.out_units))
         if activation == 'identity':
             self.activation = lambda X: X
         else:
             self.activation = nn.Activation(activation)