Ejemplo n.º 1
0
    def decoder(self, zs, reuse=False, name='decoder'):
        with tf.variable_scope(name, reuse=reuse):
            stack = Stacker(zs)
            stack.linear_block(128, relu)
            stack.linear_block(256, relu)
            stack.linear_block(512, relu)
            stack.linear_block(self.X_flatten_size, sigmoid)
            stack.reshape(self.Xs_shape)

        return stack.last_layer
Ejemplo n.º 2
0
    def discriminator(self, X, reuse=False):
        with tf.variable_scope('discriminator', reuse=reuse):
            layer = Stacker(X)
            layer.conv_block(128, CONV_FILTER_5522, lrelu)
            layer.conv_block(256, CONV_FILTER_5522, lrelu)
            layer.reshape([self.batch_size, -1])
            layer.linear(1)
            layer.sigmoid()

        return layer.last_layer
Ejemplo n.º 3
0
    def decoder(self, zs, Ys, net_shapes, reuse=False, name='decoder'):
        with tf.variable_scope(name, reuse=reuse):
            stack = Stacker(concat((zs, Ys), axis=1))

            for shape in net_shapes:
                stack.linear_block(shape, relu)

            stack.linear_block(self.X_flatten_size, sigmoid)
            stack.reshape(self.Xs_shape)

        return stack.last_layer
Ejemplo n.º 4
0
    def generator(self, z, reuse=False):
        with tf.variable_scope('generator', reuse=reuse):
            layer = Stacker(z)
            layer.add_layer(linear, 7 * 7 * 128)
            layer.reshape([self.batch_size, 7, 7, 128])
            layer.upscale_2x_block(256, CONV_FILTER_5522, relu)
            layer.conv2d_transpose(self.Xs_shape, CONV_FILTER_5522)
            layer.conv2d(self.input_c, CONV_FILTER_3311)
            layer.sigmoid()

        return layer.last_layer
Ejemplo n.º 5
0
    def generator(self, z, net_shapes, reuse=False, name='generator'):
        with tf.variable_scope(name, reuse=reuse):
            layer = Stacker(z)

            for shape in net_shapes:
                layer.linear(shape)

            layer.linear(self.X_flatten_size)
            layer.sigmoid()
            layer.reshape(self.Xs_shape)

        return layer.last_layer
Ejemplo n.º 6
0
    def discriminator(self, X, Y, reuse=False):
        with tf.variable_scope('discriminator', reuse=reuse):
            Y = linear(Y, self.input_h * self.input_w)
            Y = reshape(Y, [self.batch_size, self.input_h, self.input_w, 1])
            layer = Stacker(tf.concat((X, Y), axis=3))
            layer.conv_block(128, CONV_FILTER_5522, lrelu)
            layer.conv_block(256, CONV_FILTER_5522, lrelu)
            layer.reshape([self.batch_size, -1])
            layer.linear(1)
            layer.sigmoid()

        return layer.last_layer