(self, inputs)
| 260 | self.depth_fc.append(layers.Dense(dim)) |
| 261 | |
| 262 | def call(self, inputs): |
| 263 | nodes, adjs = euler_ops.get_multi_hop_neighbor(inputs, self.metapath) |
| 264 | hidden = [self.node_encoder(node) for node in nodes] |
| 265 | h_t = [self.depth_fc[0](hidden[0])] |
| 266 | for layer in range(self.num_layers): |
| 267 | aggregator = self.aggregators[layer] |
| 268 | next_hidden = [] |
| 269 | for hop in range(self.num_layers - layer): |
| 270 | if self.use_residual: |
| 271 | h = hidden[hop] + \ |
| 272 | aggregator((hidden[hop], hidden[hop + 1], adjs[hop])) |
| 273 | else: |
| 274 | h = aggregator((hidden[hop], hidden[hop + 1], adjs[hop])) |
| 275 | next_hidden.append(h) |
| 276 | hidden = next_hidden |
| 277 | h_t.append(self.depth_fc[layer+1](hidden[0])) |
| 278 | |
| 279 | lstm_cell = tf.nn.rnn_cell.LSTMCell(self.dim) |
| 280 | initial_state = \ |
| 281 | lstm_cell.zero_state(tf.shape(inputs)[0], dtype=tf.float32) |
| 282 | h_t = tf.concat([tf.reshape(i, [tf.shape(i)[0], 1, self.dim]) |
| 283 | for i in h_t], 1) |
| 284 | outputs, _ = tf.nn.dynamic_rnn(lstm_cell, h_t, |
| 285 | initial_state=initial_state, |
| 286 | dtype=tf.float32) |
| 287 | outputs = tf.reshape(outputs[:, 0, :], [-1, outputs.shape[2]]) |
| 288 | output_shape = inputs.shape.concatenate(outputs.shape[-1]) |
| 289 | output_shape = [d if d is not None else -1 |
| 290 | for d in output_shape.as_list()] |
| 291 | return tf.reshape(outputs, output_shape) |
| 292 | |
| 293 | |
| 294 | class ScalableGCNEncoder(GCNEncoder): |
nothing calls this directly
no test coverage detected