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

Method generator

stageII/model.py:54–113  ·  view source on GitHub ↗
(self, z_var)

Source from the content-addressed store, hash-verified

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