tensorflow之损失函数

 

#coding:utf-8
__author__ = 'similarface'

import tensorflow as tf
sess=tf.Session()

#max(features, 0)
print(sess.run(tf.nn.relu([-3,3,10])))

#min(max(features, 0), 6)
print(sess.run(tf.nn.relu6([-3., 3., 10.])))

#1/(1+exp(-x))
print(sess.run(tf.nn.sigmoid([-1., 0., 1.])))

# ((exp(x)- exp(-x))/(exp(x)+exp(-x))
print(sess.run(tf.nn.tanh([-1., 0., 1.])))

#x/(abs(x) + 1)
print(sess.run(tf.nn.softsign([-1., 0., -1.])))

#log(exp(x) + 1)
print(sess.run(tf.nn.softplus([-1., 0., -1.])))

# (exp(x)+1) if x < 0 else x
print(sess.run(tf.nn.elu([-1., 0., -1.])))

#https://www.jianshu.com/p/e3a79eac554f

 

posted @ 2018-03-20 15:28  similarface  阅读(514)  评论(0编辑  收藏  举报