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