GAN使用谱归一(spectral-normalization-gan)稳定训练——tensorflow应用
参考代码: https://github.com/christiancosgrove/pytorch-spectral-normalization-gan 参考代码: https://github.com/heykeetae/Self-Attention-GAN 参考代码: https://github.com/taki0112/Self-Attention-GAN-Tensorflow 谱归一就是限制W,使他趋于一个分布 谱归一代码部分,可以直接复制上去,调用见下个code: weight_init = tf.random_normal_initializer(mean=0.0, stddev=0.02) weight_regularizer = None def spectral_norm(w, iteration=1): w_shape = w.shape.as_list() w = tf.reshape(w, [-1, w_shape[-1]]) #print("w:",w.shape)#w: (48, 64) #w: (1024, 128) w: (2048, 256) u = tf.get_variable("u", [1, w_shape[-1]], initializer=tf.truncated_normal_initializer(), trainable