in models.py [0:0]
def forward(self, inp, weights, reuse=False, scope='', stop_grad=False, label=None, **kwargs):
channels = self.channels
weights = weights.copy()
inp = tf.reshape(inp, (tf.shape(inp)[0], 28, 28, 1))
if FLAGS.swish_act:
act = swish
else:
act = tf.nn.leaky_relu
if stop_grad:
for k, v in weights.items():
if type(v) == dict:
v = v.copy()
weights[k] = v
for k_sub, v_sub in v.items():
v[k_sub] = tf.stop_gradient(v_sub)
else:
weights[k] = tf.stop_gradient(v)
if FLAGS.cclass:
label_d = tf.reshape(label, shape=(tf.shape(label)[0], 1, 1, self.label_size))
inp = conv_cond_concat(inp, label_d)
h1 = smart_conv_block(inp, weights, reuse, 'c1_pre', use_stride=False, activation=act)
h2 = smart_conv_block(h1, weights, reuse, 'c1', use_stride=True, downsample=True, label=label, extra_bias=False, activation=act)
h3 = smart_conv_block(h2, weights, reuse, 'c2', use_stride=True, downsample=True, label=label, extra_bias=False, activation=act)
h4 = smart_conv_block(h3, weights, reuse, 'c3', use_stride=True, downsample=True, label=label, use_scale=False, extra_bias=False, activation=act)
h5 = tf.reshape(h4, [-1, np.prod([int(dim) for dim in h4.get_shape()[1:]])])
h6 = act(smart_fc_block(h5, weights, reuse, 'fc_dense'))
hidden6 = smart_fc_block(h6, weights, reuse, 'fc5')
return hidden6