tensorflow Relu激活函数


1、Relu激活函数

Relu激活函数(The Rectified Linear Unit)表达式为:f(x)=max(0,x)

2、tensorflow实现

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import tensorflow as tf

input_data = tf.constant( [[0, 10, -10],[-1,2,-3]] , dtype = tf.float32 )
output = tf.nn.relu(input_data)
sess=tf.Session()

print(sess.run(output))

输出为:

[[ 0. 10. 0.]
[ 0. 2. 0.]]

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM