def network(self, image, batch_size): h0 = lrelu(conv2d(image, self.dim, name=self.prefix + 'h0_conv')) h1 = lrelu( self.d_bn1(conv2d(h0, self.dim * 2, name=self.prefix + 'h1_conv'))) h2 = lrelu( self.d_bn2(conv2d(h1, self.dim * 4, name=self.prefix + 'h2_conv'))) h3 = lrelu( self.d_bn3(conv2d(h2, self.dim * 8, name=self.prefix + 'h3_conv'))) hF = lrelu( self.d_bn4(conv2d(h3, self.o_dim, name=self.prefix + 'hF_conv'))) hF = tf.reshape(hF, [batch_size, -1]) return {'h0': h0, 'h1': h1, 'h2': h2, 'h3': h3, 'hF': hF}
def network(self, image, batch_size): o_dim = self.o_dim if (self.o_dim > 0) else 8 * self.dim h0 = lrelu(conv2d(image, self.dim, name=self.prefix + 'h0_conv')) h1 = lrelu( self.d_bn1(conv2d(h0, self.dim * 2, name=self.prefix + 'h1_conv'))) h2 = lrelu( self.d_bn2(conv2d(h1, self.dim * 4, name=self.prefix + 'h2_conv'))) h3 = lrelu( self.d_bn3(conv2d(h2, self.dim * 8, name=self.prefix + 'h3_conv'))) hF = linear(tf.reshape(h3, [batch_size, -1]), o_dim, self.prefix + 'h4_lin') return {'h0': h0, 'h1': h1, 'h2': h2, 'h3': h3, 'hF': hF}
def network(self, image, batch_size): from core.resnet import block, ops image = tf.transpose(image, [0, 3, 1, 2]) # NHWC to NCHW h0 = lrelu( ops.conv2d.Conv2D(self.prefix + 'h0_conv', 3, self.dim, 3, image, he_init=False)) h1 = block.ResidualBlock(self.prefix + 'res1', self.dim, 2 * self.dim, 3, h0, resample='down') h2 = block.ResidualBlock(self.prefix + 'res2', 2 * self.dim, 4 * self.dim, 3, h1, resample='down') h3 = block.ResidualBlock(self.prefix + 'res3', 4 * self.dim, 8 * self.dim, 3, h2, resample='down') h4 = block.ResidualBlock(self.prefix + 'res4', 8 * self.dim, 8 * self.dim, 3, h3, resample='down') hF = tf.reshape(h4, [-1, 4 * 4 * 8 * self.dim]) hF = linear(hF, self.o_dim, self.prefix + 'h5_lin') return {'h0': h0, 'h1': h1, 'h2': h2, 'h3': h3, 'h4': h4, 'hF': hF}