Tensorflow Layers Api线性激活函数

2024-10-01 17:33:02 发布

您现在位置:Python中文网/ 问答频道 /正文

这个问题和这个问题很相似:How to use a linear activation function in TensorFlow?但是不同。在

在最后一个稠密层上,我想输出28个节点的线性激活,而不是sigmoid。我正在使用新的layers api,如下所示:https://www.tensorflow.org/tutorials/layers

但是,我的最后一层堆栈如下所示:

flat = tf.reshape(pool3, [-1, 128 * 128 * 128]) #width (after poolings), height (after poolings), filters
dense1 = tf.layers.dense(inputs=flat, units=4096, activation=tf.nn.relu)
dense2 = tf.layers.dense(inputs=dense1, units=4096, activation=tf.nn.relu)
dropout = tf.layers.dropout(
            inputs=dense2, rate=0.4, training=mode == learn.ModeKeys.TRAIN)
output = tf.layers.dense(inputs=dropout, units=28)

on如何确保28个节点的输出实际上是线性的?在CNTK中,将激活函数指定为None(请参见此处:cntk linear activation function in layers?

非常感谢指点。谢谢!在


Tags: in节点layerstffunction线性activationdropout

热门问题