参考:https://my.oschina.net/u/876354/blog/1940819
https://zhuanlan.zhihu.com/p/33560183
https://www.jianshu.com/p/cf235861311b
总结,对于回归问题经常会使用MSE均方误差(L2取平均)计算损失,对于分类问题经常会使用Sigmoid交叉熵损失函数。
# L2损失
loss_l2_vals=tf.square(y_pred - y_target)
loss_l2_out=sess.run(loss_l2_vals)
# 均方误差
loss_mse_vals= tf.reduce.mean(tf.square(y_pred - y_target))
loss_mse_out = sess.run(loss_mse_vals)
原文:https://www.cnblogs.com/ying-chease/p/14245824.html