def _build(self): self.hidden1 = GraphConvolutionSparse(input_dim=self.input_dim, output_dim=FLAGS.hidden1, adj=self.adj, features_nonzero=self.features_nonzero, act=tf.nn.relu, dropout=self.dropout, logging=self.logging)(self.inputs) self.z_mean = GraphConvolution(input_dim=FLAGS.hidden1, output_dim=FLAGS.hidden2, adj=self.adj, act=lambda x: x, dropout=self.dropout, logging=self.logging)(self.hidden1) self.z_log_std = GraphConvolution(input_dim=FLAGS.hidden1, output_dim=FLAGS.hidden2, adj=self.adj, act=lambda x: x, dropout=self.dropout, logging=self.logging)(self.hidden1) self.z = self.z_mean + tf.random_normal([self.n_samples, FLAGS.hidden2]) * tf.sqrt(tf.exp(self.z_log_std)) self.soft_z = tf.nn.softmax(self.z,axis =-1) self.reconstructions = InnerProductDecoder(input_dim=FLAGS.hidden2, act=lambda x: x, logging=self.logging)(self.z)
def decoder(self, z): reconstructions = InnerProductDecoder(input_dim=FLAGS.hidden2, act=lambda x: x, dropout=0., logging=self.logging)(z) reconstructions = tf.reshape(reconstructions, [-1]) return reconstructions
def make_decoder(self): self.l0 = Dense(input_dim=self.input_dim, output_dim=FLAGS.hidden3, act=tf.nn.elu, dropout=0., bias=True, logging=self.logging) self.l1 = Dense(input_dim=FLAGS.hidden2, output_dim=FLAGS.hidden3, act=tf.nn.elu, dropout=0., bias=True, logging=self.logging) self.l2 = Dense(input_dim=FLAGS.hidden3, output_dim=FLAGS.hidden2, act=lambda x: x, dropout=self.dropout, bias=True, logging=self.logging) self.l3 = Dense(input_dim=2 * FLAGS.hidden2, output_dim=FLAGS.hidden3, act=tf.nn.elu, dropout=self.dropout, bias=True, logging=self.logging) self.l3p5 = Dense(input_dim=FLAGS.hidden3, output_dim=FLAGS.hidden3, act=tf.nn.elu, dropout=self.dropout, bias=True, logging=self.logging) self.l4 = Dense(input_dim=FLAGS.hidden3, output_dim=1, act=lambda x: x, dropout=self.dropout, bias=True, logging=self.logging) self.l5 = InnerProductDecoder(input_dim=FLAGS.hidden2, act=lambda x: x, logging=self.logging)
def _build(self): self.hidden1 = GraphConvolutionSparse(input_dim=self.input_dim, output_dim=FLAGS.hidden1, adj=self.adj, features_nonzero=self.features_nonzero, act=tf.nn.relu, dropout=self.dropout, logging=self.logging)(self.inputs) self.embeddings = GraphConvolution(input_dim=FLAGS.hidden1, output_dim=FLAGS.hidden2, adj=self.adj, act=lambda x: x, dropout=self.dropout, logging=self.logging)(self.hidden1) self.z_mean = self.embeddings self.reconstructions = InnerProductDecoder(input_dim=FLAGS.hidden2, act=lambda x: x, logging=self.logging)(self.embeddings)
def make_decoder(self): self.l0 = GraphiteSparse(input_dim=self.input_dim, output_dim=FLAGS.hidden3, act=tf.nn.relu, dropout=0., logging=self.logging) self.l1 = Graphite(input_dim=FLAGS.hidden2, output_dim=FLAGS.hidden3, act=tf.nn.relu, dropout=0., logging=self.logging) self.l2 = Graphite(input_dim=FLAGS.hidden3, output_dim=FLAGS.hidden2, act=lambda x: x, dropout=self.dropout, logging=self.logging) self.l3 = InnerProductDecoder(input_dim=FLAGS.hidden2, act=lambda x: x, logging=self.logging) self.l4 = Scale(input_dim=FLAGS.hidden2, logging=self.logging)