概述
relu称为线性整流函数(修正线性单元),tf.nn.relu()用于将输入小于0的值增幅为0,输入大于0的值不变。
用法
tf.nn.relu(features, name=None)
例子
import tensorflow as tf
tf.compat.v1.disable_eager_execution()
sess = tf.compat.v1.Session()
a = tf.constant([-1.0,2.0])
a = tf.nn.relu(a)
print(sess.run(a))
OUT:

希望这篇文章对大家的学习有所帮助!
所有评论(0)