MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / generator

Method generator

examples/GAN/CycleGAN.py:60–75  ·  view source on GitHub ↗
(self, img)

Source from the content-addressed store, hash-verified

58
59 @auto_reuse_variable_scope
60 def generator(self, img):
61 assert img is not None
62 with argscope([Conv2D, Conv2DTranspose], activation=INReLU):
63 l = (LinearWrap(img)
64 .tf.pad([[0, 0], [0, 0], [3, 3], [3, 3]], mode='SYMMETRIC')
65 .Conv2D('conv0', NF, 7, padding='VALID')
66 .Conv2D('conv1', NF * 2, 3, strides=2)
67 .Conv2D('conv2', NF * 4, 3, strides=2)())
68 for k in range(9):
69 l = Model.build_res_block(l, 'res{}'.format(k), NF * 4, first=(k == 0))
70 l = (LinearWrap(l)
71 .Conv2DTranspose('deconv0', NF * 2, 3, strides=2)
72 .Conv2DTranspose('deconv1', NF * 1, 3, strides=2)
73 .tf.pad([[0, 0], [0, 0], [3, 3], [3, 3]], mode='SYMMETRIC')
74 .Conv2D('convlast', 3, 7, padding='VALID', activation=tf.tanh, use_bias=True)())
75 return l
76
77 @auto_reuse_variable_scope
78 def discriminator(self, img):

Callers 1

build_graphMethod · 0.95

Calls 4

argscopeFunction · 0.85
LinearWrapClass · 0.85
build_res_blockMethod · 0.80
formatMethod · 0.80

Tested by

no test coverage detected