A:
1.原因:在跑GAN时由于keras无法使用tensorflow的LeakyReLU,可能没有此函数,2.step:
(1)
自定义添加到models.py里:
def LeakyReLU(x, leak=0.2, name="lrelu")
with tf.variable_scope(name):
f1 = 0.5 * (1 + leak)
f2 = 0.5 * (1 - leak)
return f1 * x + f2 * abs(x)
(2)
from keras.layers import Lambda
x = Lambda(lambda x: LeakyReLU(x))(x)
说明:没有第二步,会报错:
AttributeError: 'Tensor' object has no attribute '_keras_history'
B:
GANs_N_Roses:https://github.com/Naresh1318/GANs_N_Roses运行该github时有
ValueError: Variable d_h0_conv/w/Adam/ does not exist, or was not created with tf.get_variable(). Did you mean to set re