Ejemplo n.º 1
0
def Discriminator(input, reuse=False):
    with tf.variable_scope("Discriminator") as scope:
        if reuse:
            scope.reuse_variables()
        image = tf.reshape(input, [-1, 28, 28, 1])

        conv1 = tlib.Con2D(image, FLAGS.DIM, 5, 2, scope="conv1")

        relu1 = tlib.leaky_relu(conv1)

        conv2 = tlib.Con2D(relu1, 2 * FLAGS.DIM, 5, 2, scope="conv2")

        relu2 = tlib.leaky_relu(conv2)

        conv3 = tlib.Con2D(relu2, 4 * FLAGS.DIM, 5, 2, scope="conv3")

        relu3 = tlib.leaky_relu(conv3)

        out_put = tf.reshape(relu3, [-1, 4 * 4 * 4 * FLAGS.DIM])

        fc1_source = tlib.fc(out_put, 1, scope="fc1")

        fc2_class = tlib.fc(out_put, FLAGS.n_class, scope="fc2")

        fc3_con = tlib.fc(out_put, 2, scope="fc3")

        n_class_ = tf.nn.softmax(fc2_class, name="class")

    return fc1_source, fc2_class, fc3_con, n_class_
Ejemplo n.º 2
0
def Discriminator_k(input, reuse=False):
    with tf.variable_scope("Discriminator") as scope:
        if reuse:
            scope.reuse_variables()
        #image = tf.transpose(tf.reshape(input,[-1,3,32,32]),perm=[0,2,3,1])
        conv1 = tlib.Con2D(input, FLAGS.DIM, 5, 2, scope="conv1")
        relu1 = tlib.leaky_relu(conv1)
        conv2 = tlib.Con2D(relu1, 2 * FLAGS.DIM, 5, 2, scope="conv2")
        relu2 = tlib.leaky_relu(conv2)
        conv3 = tlib.Con2D(relu2, 4 * FLAGS.DIM, 5, 2, scope="conv3")
        relu3 = tlib.leaky_relu(conv3)
        out_put = tf.reshape(relu3, [-1, 4 * 4 * 4 * FLAGS.DIM])
        fc1 = tlib.fc(out_put, 1, scope="fc1")
    return tf.reshape(fc1, [-1])
Ejemplo n.º 3
0
def Discriminator(input, reuse=False):
    with tf.variable_scope("Discriminator") as scope:
        if reuse:
            scope.reuse_variables()
        image = tf.reshape(input, [-1, 28, 28, 1])

        conv1 = tlib.Con2D(image, FLAGS.DIM, 5, 2, scope="conv1")

        relu1 = tlib.leaky_relu(conv1)

        conv2 = tlib.Con2D(relu1, 2 * FLAGS.DIM, 5, 2, scope="conv2")

        relu2 = tlib.leaky_relu(conv2)

        conv3 = tlib.Con2D(relu2, 4 * FLAGS.DIM, 5, 2, scope="conv3")

        relu3 = tlib.leaky_relu(conv3)

        out_put = tf.reshape(relu3, [-1, 4 * 4 * 4 * FLAGS.DIM])

        fc1 = tlib.fc(out_put, 1, scope="fc1")

    return fc1