在Tensorflow中使用泄漏的relu
问题内容:
如何更改G_h1 = tf.nn.relu(tf.matmul(z, G_W1) + G_b1)
为漏水的relu?我已经尝试过使用张量循环max(value, 0,01*value)
但我得到了TypeError: Using a tf.Tensor as a Python bool is not allowed.
我还尝试在Tensorflow github上的relu上找到源代码,以便可以将其修改为泄漏的relu,但我找不到它。
问题答案:
您可以根据编写一个tf.relu
,例如:
def lrelu(x, alpha):
return tf.nn.relu(x) - alpha * tf.nn.relu(-x)
编辑
Tensorflow
1.4现在具有本机tf.nn.leaky_relu
。