MCPcopy Create free account
hub / github.com/tensorpack/tensorpack / build_graph

Method build_graph

examples/GAN/DCGAN.py:79–95  ·  view source on GitHub ↗
(self, image_pos)

Source from the content-addressed store, hash-verified

77 return l
78
79 def build_graph(self, image_pos):
80 image_pos = image_pos / 128.0 - 1
81
82 z = tf.random_uniform([self.batch, self.zdim], -1, 1, name='z_train')
83 z = tf.placeholder_with_default(z, [None, self.zdim], name='z')
84
85 with argscope([Conv2D, Conv2DTranspose, FullyConnected],
86 kernel_initializer=tf.truncated_normal_initializer(stddev=0.02)):
87 with tf.variable_scope('gen'):
88 image_gen = self.generator(z)
89 tf.summary.image('generated-samples', image_gen, max_outputs=30)
90 with tf.variable_scope('discrim'):
91 vecpos = self.discriminator(image_pos)
92 vecneg = self.discriminator(image_gen)
93
94 self.build_losses(vecpos, vecneg)
95 self.collect_variables()
96
97 def optimizer(self):
98 lr = tf.get_variable('learning_rate', initializer=2e-4, trainable=False)

Callers

nothing calls this directly

Calls 5

generatorMethod · 0.95
discriminatorMethod · 0.95
build_lossesMethod · 0.95
argscopeFunction · 0.85
collect_variablesMethod · 0.45

Tested by

no test coverage detected