使用Tensorflow 1.5,我想补充leaky_relu活化的致密层的输出,而我能够改变alpha的leaky_relu(检查这里)。我知道我可以这样做:
output = tf.layers.dense(input, n_units)
output = tf.nn.leaky_relu(output, alpha=0.01)
Run Code Online (Sandbox Code Playgroud)
我想知道是否有一种方法可以将其写在一行中,因为我们可以这样做relu:
ouput = tf.layers.dense(input, n_units, activation=tf.nn.relu)
我尝试了以下操作,但出现错误:
output = tf.layers.dense(input, n_units, activation=tf.nn.leaky_relu(alpha=0.01))
TypeError: leaky_relu() missing 1 required positional argument: 'features'
Run Code Online (Sandbox Code Playgroud)
有没有办法做到这一点?