概述

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:
在这里插入图片描述


希望这篇文章对大家的学习有所帮助!

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐