MCPcopy Index your code
hub / github.com/hanzhanggit/StackGAN / generator

Method generator

stageI/model.py:53–112  ·  view source on GitHub ↗
(self, z_var)

Source from the content-addressed store, hash-verified

51 return [mean, log_sigma]
52
53 def generator(self, z_var):
54 node1_0 =\
55 (pt.wrap(z_var).
56 flatten().
57 custom_fully_connected(self.s16 * self.s16 * self.gf_dim * 8).
58 fc_batch_norm().
59 reshape([-1, self.s16, self.s16, self.gf_dim * 8]))
60 node1_1 = \
61 (node1_0.
62 custom_conv2d(self.gf_dim * 2, k_h=1, k_w=1, d_h=1, d_w=1).
63 conv_batch_norm().
64 apply(tf.nn.relu).
65 custom_conv2d(self.gf_dim * 2, k_h=3, k_w=3, d_h=1, d_w=1).
66 conv_batch_norm().
67 apply(tf.nn.relu).
68 custom_conv2d(self.gf_dim * 8, k_h=3, k_w=3, d_h=1, d_w=1).
69 conv_batch_norm())
70 node1 = \
71 (node1_0.
72 apply(tf.add, node1_1).
73 apply(tf.nn.relu))
74
75 node2_0 = \
76 (node1.
77 # custom_deconv2d([0, self.s8, self.s8, self.gf_dim * 4], k_h=4, k_w=4).
78 apply(tf.image.resize_nearest_neighbor, [self.s8, self.s8]).
79 custom_conv2d(self.gf_dim * 4, k_h=3, k_w=3, d_h=1, d_w=1).
80 conv_batch_norm())
81 node2_1 = \
82 (node2_0.
83 custom_conv2d(self.gf_dim * 1, k_h=1, k_w=1, d_h=1, d_w=1).
84 conv_batch_norm().
85 apply(tf.nn.relu).
86 custom_conv2d(self.gf_dim * 1, k_h=3, k_w=3, d_h=1, d_w=1).
87 conv_batch_norm().
88 apply(tf.nn.relu).
89 custom_conv2d(self.gf_dim * 4, k_h=3, k_w=3, d_h=1, d_w=1).
90 conv_batch_norm())
91 node2 = \
92 (node2_0.
93 apply(tf.add, node2_1).
94 apply(tf.nn.relu))
95
96 output_tensor = \
97 (node2.
98 # custom_deconv2d([0, self.s4, self.s4, self.gf_dim * 2], k_h=4, k_w=4).
99 apply(tf.image.resize_nearest_neighbor, [self.s4, self.s4]).
100 custom_conv2d(self.gf_dim * 2, k_h=3, k_w=3, d_h=1, d_w=1).
101 conv_batch_norm().
102 apply(tf.nn.relu).
103 # custom_deconv2d([0, self.s2, self.s2, self.gf_dim], k_h=4, k_w=4).
104 apply(tf.image.resize_nearest_neighbor, [self.s2, self.s2]).
105 custom_conv2d(self.gf_dim, k_h=3, k_w=3, d_h=1, d_w=1).
106 conv_batch_norm().
107 apply(tf.nn.relu).
108 # custom_deconv2d([0] + list(self.image_shape), k_h=4, k_w=4).
109 apply(tf.image.resize_nearest_neighbor, [self.s, self.s]).
110 custom_conv2d(3, k_h=3, k_w=3, d_h=1, d_w=1).

Callers 1

get_generatorMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected