| 132 | class GraphConvolution(Layer): |
| 133 | """Graph convolution layer.""" |
| 134 | def __init__(self, input_dim, output_dim, placeholders, dropout=0., |
| 135 | sparse_inputs=False, act=tf.nn.relu, bias=False, |
| 136 | featureless=False, **kwargs): |
| 137 | super(GraphConvolution, self).__init__(**kwargs) |
| 138 | |
| 139 | if dropout: |
| 140 | self.dropout = placeholders['dropout'] |
| 141 | else: |
| 142 | self.dropout = 0. |
| 143 | |
| 144 | self.act = act |
| 145 | self.support = placeholders['support'] |
| 146 | self.sparse_inputs = sparse_inputs |
| 147 | self.featureless = featureless |
| 148 | self.bias = bias |
| 149 | |
| 150 | # helper variable for sparse dropout |
| 151 | self.num_features_nonzero = placeholders['num_features_nonzero'] |
| 152 | |
| 153 | with tf.variable_scope(self.name + '_vars'): |
| 154 | for i in range(len(self.support)): |
| 155 | self.vars['weights_' + str(i)] = glorot([input_dim, output_dim], |
| 156 | name='weights_' + str(i)) |
| 157 | if self.bias: |
| 158 | self.vars['bias'] = zeros([output_dim], name='bias') |
| 159 | |
| 160 | if self.logging: |
| 161 | self._log_vars() |
| 162 | |
| 163 | def _call(self, inputs): |
| 164 | x = inputs |