MCPcopy Create free account
hub / github.com/OUCMachineLearning/OUCML / discriminator

Function discriminator

GAN/datadownloader/model.py:52–83  ·  view source on GitHub ↗
(inputs, is_train=True, reuse=False)

Source from the content-addressed store, hash-verified

50 return net_h4
51
52def discriminator(inputs, is_train=True, reuse=False):
53 df_dim = 64 # Dimension of discrim filters in first conv layer. [64]
54 w_init = tf.glorot_normal_initializer()
55 gamma_init = tf.random_normal_initializer(1., 0.02)
56
57 with tf.variable_scope("discriminator", reuse=reuse):
58
59 net_in = InputLayer(inputs, name='d/in')
60 net_h0 = Conv2d(net_in, df_dim, (5, 5), (2, 2), act=tf.nn.leaky_relu,
61 padding='SAME', W_init=w_init, name='d/h0/conv2d')
62
63 net_h1 = Conv2d(net_h0, df_dim*2, (5, 5), (2, 2), act=None,
64 padding='SAME', W_init=w_init, name='d/h1/conv2d')
65 net_h1 = BatchNormLayer(net_h1, act=tf.nn.leaky_relu,
66 is_train=is_train, gamma_init=gamma_init, name='d/h1/batch_norm')
67
68 net_h2 = Conv2d(net_h1, df_dim*4, (5, 5), (2, 2), act=None,
69 padding='SAME', W_init=w_init, name='d/h2/conv2d')
70 net_h2 = BatchNormLayer(net_h2, act=tf.nn.leaky_relu,
71 is_train=is_train, gamma_init=gamma_init, name='d/h2/batch_norm')
72
73 net_h3 = Conv2d(net_h2, df_dim*8, (5, 5), (2, 2), act=None,
74 padding='SAME', W_init=w_init, name='d/h3/conv2d')
75 net_h3 = BatchNormLayer(net_h3, act=tf.nn.leaky_relu,
76 is_train=is_train, gamma_init=gamma_init, name='d/h3/batch_norm')
77
78 net_h4 = FlattenLayer(net_h3, name='d/h4/flatten')
79 net_h4 = DenseLayer(net_h4, n_units=1, act=tf.identity,
80 W_init = w_init, name='d/h4/lin_sigmoid')
81 logits = net_h4.outputs
82 net_h4.outputs = tf.nn.sigmoid(net_h4.outputs)
83 return net_h4, logits

Callers 1

mainFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected