TensorFlow softmax的互熵损失
函数:tf.nn.softmax_cross_entropy_with_logits(logits, labels, name=None)
功能:这个函数的作用是计算 logits 经 softmax 函数激活之后的交叉熵
实例:
inputdata = tf.Variable([[0.2, 0.1, 0.9]], dtype=np.float32)
output = tf.nn.softmax_cross_entropy_with_logits(logits=inputdata, labels = [[1.0, 0.0, 0.0]])
with tf.Session() as sess:
sess.run(tf.global_variables_initializer())
print (sess.run(inputdata))
print (sess.run(output))
输出:
[[ 0.2 0.1 0.89999998]]
[ 1.36573195]
TensorFlow softmax的互熵损失的更多相关文章
- tensorflow softmax应用
---恢复内容开始--- 1.softmax函数 2.tensorflow实现例子 #!/usr/bin/env python # -*- coding: utf-8 -*- import tenso ...
- 2.tensorflow——Softmax回归
import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from tensorflow.examples. ...
- cs224d 作业 problem set1 (一) 主要是实现word2vector模型,SGD,CBOW,Softmax,算法
''' Created on 2017年9月13日 @author: weizhen ''' import numpy as np def sigmoid(x): return 1 / (1 + np ...
- TensorFlow构建卷积神经网络/模型保存与加载/正则化
TensorFlow 官方文档:https://www.tensorflow.org/api_guides/python/math_ops # Arithmetic Operators import ...
- 损失函数 hinge loss vs softmax loss
1. 损失函数 损失函数(Loss function)是用来估量你模型的预测值 f(x) 与真实值 Y 的不一致程度,它是一个非负实值函数,通常用 L(Y,f(x)) 来表示. 损失函数越小,模型的鲁 ...
- 深度学习与计算机视觉系列(3)_线性SVM与SoftMax分类器
作者: 寒小阳 &&龙心尘 时间:2015年11月. 出处: http://blog.csdn.net/han_xiaoyang/article/details/49949535 ht ...
- TensorFlow 常用函数汇总
本文介绍了tensorflow的常用函数,源自网上整理. TensorFlow 将图形定义转换成分布式执行的操作, 以充分利用可用的计算资源(如 CPU 或 GPU.一般你不需要显式指定使用 CPU ...
- TensorFlow 常用函数与方法
摘要:本文主要对tf的一些常用概念与方法进行描述. tf函数 TensorFlow 将图形定义转换成分布式执行的操作, 以充分利用可用的计算资源(如 CPU 或 GPU.一般你不需要显式指定使用 CP ...
- Tensorflow一些常用基本概念与函数
1.tensorflow的基本运作 为了快速的熟悉TensorFlow编程,下面从一段简单的代码开始: import tensorflow as tf #定义‘符号’变量,也称为占位符 a = tf. ...
随机推荐
- SpringBoot------thymeleaf的使用
1.pom.xml添加相应依赖 <dependency> <groupId>org.springframework.boot</groupId> <artif ...
- [AX]AX2012 R2 HR Jobs, Positions, Department和Workers
部门.作业(Job的官方翻译)和位置(Position的官方翻译)是AX人力资源管理的基本组织元素,Job和Position在AX有的地方又称作工作和职位,其实这个翻译更为恰当. Job定义的是一个工 ...
- iframe设置高度为100%
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- python是c语言开发的
python是c语言开发的. #c语言,没有字符串:字符串使用字符组表现 hello —五个字符 字符数组 [’h’,’e’,…’o’] 所以python中如果对一个字符串进行修改,就是在内存 ...
- 打破基于OpenResty的WEB安全防护(CVE-2018-9230)
原文首发于安全客,原文链接:https://www.anquanke.com/post/id/103771 0x00 前言 OpenResty® 是一个基于 Nginx 与 Lua 的高性能 We ...
- CookieUtils工具类
package com.taotao.common.util; import java.io.UnsupportedEncodingException; import java.net.URLDeco ...
- 解决node里面的中文乱码
今天咋学习node的时候,跟着视频里在撸代码,但是却出现了中文乱码的情况,视频中的谷歌浏览器可能和我的版本不一致,先看代码吧: 'use strict'; const http = require(& ...
- 命令行连接mysql服务器时 报Can't connect to local MySQL server through socket 'xxx.sock'错误
本来之前用的好好的mysql服务器,突然就报Can't connect to local MySQL server through socket 'xxx.sock'错误了 遇到该问题思路首先是:检查 ...
- Java连接SqlServer2008数据库
Java连接SqlServer2008数据库 首先下载JDBC:下载地址:http://www.microsoft.com/zh-cn/download/details.aspx?id=21599 下 ...
- 【WEB前端系列之CSS】CSS3动画之Animation
前言 动画使用示例https://github.com/AndyFlower/web-front/tree/master/css3/loading 学习CSS3中Animation之前先来看一个动画特 ...