MCPcopy Create free account
hub / github.com/SystemErrorWang/White-box-Cartoonization / generator

Function generator

train_code/network.py:30–59  ·  view source on GitHub ↗
(inputs, channel=32, num_blocks=4, name='generator', reuse=False)

Source from the content-addressed store, hash-verified

28
29
30def generator(inputs, channel=32, num_blocks=4, name='generator', reuse=False):
31 with tf.variable_scope(name, reuse=reuse):
32
33 x = slim.convolution2d(inputs, channel, [7, 7], activation_fn=None)
34 x = tf.nn.leaky_relu(x)
35
36 x = slim.convolution2d(x, channel*2, [3, 3], stride=2, activation_fn=None)
37 x = slim.convolution2d(x, channel*2, [3, 3], activation_fn=None)
38 x = tf.nn.leaky_relu(x)
39
40 x = slim.convolution2d(x, channel*4, [3, 3], stride=2, activation_fn=None)
41 x = slim.convolution2d(x, channel*4, [3, 3], activation_fn=None)
42 x = tf.nn.leaky_relu(x)
43
44 for idx in range(num_blocks):
45 x = resblock(x, out_channel=channel*4, name='block_{}'.format(idx))
46
47 x = slim.conv2d_transpose(x, channel*2, [3, 3], stride=2, activation_fn=None)
48 x = slim.convolution2d(x, channel*2, [3, 3], activation_fn=None)
49
50 x = tf.nn.leaky_relu(x)
51
52 x = slim.conv2d_transpose(x, channel, [3, 3], stride=2, activation_fn=None)
53 x = slim.convolution2d(x, channel, [3, 3], activation_fn=None)
54 x = tf.nn.leaky_relu(x)
55
56 x = slim.convolution2d(x, 3, [7, 7], activation_fn=None)
57 #x = tf.clip_by_value(x, -0.999999, 0.999999)
58
59 return x
60
61
62def unet_generator(inputs, channel=32, num_blocks=4, name='generator', reuse=False):

Callers

nothing calls this directly

Calls 1

resblockFunction · 0.70

Tested by

no test coverage detected