tf.nn.relu(features, name = None)
这个函数的作用是计算激活函数 relu,即 max(features, 0)。将大于0的保持不变,小于0的数置为0。
import tensorflow as tf a = tf.constant([-1.0, 2.0]) with tf.Session() as sess: b = tf.nn.relu(a) print sess.run(b)
以上程序输出的结果是:[0. 2.]
tf.nn.relu(features, name = None)
这个函数的作用是计算激活函数 relu,即 max(features, 0)。将大于0的保持不变,小于0的数置为0。
import tensorflow as tf a = tf.constant([-1.0, 2.0]) with tf.Session() as sess: b = tf.nn.relu(a) print sess.run(b)
以上程序输出的结果是:[0. 2.]
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。