tensorflow 中 softmax_cross_entropy_with_logits 与 sparse_softmax_cross_entropy_with_logits 的区别
http://stackoverflow.com/questions/37312421/tensorflow-whats-the-difference-between-sparse-softmax-cross-entropy-with-logi
Having two different functions is a convenience, as they produce the same result.
The difference is simple:
- For
sparse_softmax_cross_entropy_with_logits, labels must have the shape [batch_size] and the dtype int32 or int64. Each label is an int in range[0, num_classes-1]. - For
softmax_cross_entropy_with_logits, labels must have the shape [batch_size, num_classes] and dtype float32 or float64.
Labels used in softmax_cross_entropy_with_logits are the one hot version of labels used in sparse_softmax_cross_entropy_with_logits.
Another tiny difference is that with sparse_softmax_cross_entropy_with_logits, you can give -1 as a label to have loss 0 on this label.
tensorflow 中 softmax_cross_entropy_with_logits 与 sparse_softmax_cross_entropy_with_logits 的区别的更多相关文章
- tensorflow中run和eval的区别(转)
在tensorflow中,eval和run都是获取当前结点的值的一种方式. 在使用eval时,若有一个 t 是Tensor对象,调用t.eval()相当于调用sess.run(t) 一下两段代码等效: ...
- 【tensorflow】softmax_cross_entropy_with_logits与sparse_softmax_cross_entropy_with_logits
softmax_cross_entropy_with_logits与sparse_softmax_cross_entropy_with_logits都是对最后的预测结果进行softmax然后求交叉熵 ...
- tf中softmax_cross_entropy_with_logits与sparse_softmax_cross_entropy_with_logits
其实这两个都是计算交叉熵,只是输入数据不同. #sparse 稀疏的.稀少的 word_labels = tf.constant([2,0]) predict_logits = tf.constant ...
- TensorFlow中random_normal和truncated_normal的区别
原文链接:https://blog.csdn.net/zhangdongren/article/details/83344048 区别如下: tf.random_normal(shape,mean=0 ...
- [开发技巧]·TensorFlow中numpy与tensor数据相互转化
[开发技巧]·TensorFlow中numpy与tensor数据相互转化 个人主页–> https://xiaosongshine.github.io/ - 问题描述 在我们使用TensorFl ...
- 记录:TensorFlow 中的 padding 方式
TensorFlow 中卷积操作和池化操作中都有一个参数 padding,其可选值有 ['VALID', 'SAME']. 在 TensorFlow 文档中只是给出了输出张量的维度计算方式,但是并没有 ...
- (原)tensorflow中函数执行完毕,显存不自动释放
转载请注明出处: http://www.cnblogs.com/darkknightzh/p/7608916.html 参考网址: https://stackoverflow.com/question ...
- Tensorflow中的name_scope和variable_scope
Tensorflow是一个编程模型,几乎成为了一种编程语言(里面有变量.有操作......). Tensorflow编程分为两个阶段:构图阶段+运行时. Tensorflow构图阶段其实就是在对图进行 ...
- Tensorflow中的run()函数
1 run()函数存在的意义 run()函数可以让代码变得更加简洁,在搭建神经网络(一)中,经历了数据集准备.前向传播过程设计.损失函数及反向传播过程设计等三个过程,形成计算网络,再通过会话tf.Se ...
随机推荐
- OpenERP report doesn't work
1. When you have used OpenOffice edited one of reports,it has stored the report's banary data is da ...
- 小型web服务器thttpd的学习总结(下)
1.主函数模块分析 对于主函数而言,概括来说主要做了三点内容,也就是初始化系统,进行系统大循环,退出系统.下面主要简单阐述下在这三个部分,又做了哪些工作呢. 初始化系统 拿出程序的名字(argv[0] ...
- 爬虫 (4)- Selenium与PhantomJS(chromedriver)与爬取案例
Selenium文档 Selenium是一个Web的自动化测试工具,最初是为网站自动化测试而开发的,类型像我们玩游戏用的按键精灵,可以按指定的命令自动操作,不同是Selenium 可以直接运行在浏览器 ...
- flask os.environ 的作用
使用环境变量取值, 是为了增强系统的适应性, 在某些场景下, 设置环境变量比较方便. 假如, 你有一套代码, 部署在不同的系统中, 恰好这些系统有权限且很容易地设置环境变量, 那么, 这时候通过环境变 ...
- 12 jsp page 指令
jsp 指令影响由 jsp 页面生成的 servlet 整体结构. jsp page 用来设置整个页面属性, 例如 import 就是引用这些类, 还可以设置 session 等等. <%@ p ...
- 哈希表类Hashtable
哈希表是一种重要的存储方式,也是一种常见的检索方法.其基本思想是将关系码的值作为自变量,通过一定的函数关系计算出对应的函数值,把这个数值解释为结点的存储地址,将结点存入计算得到存储地址所对应的存储单元 ...
- ios 页面过长卡顿的情况
解决方案如下: -webkit-overflow-scrolling: touch;
- 房间WIFI信号不好怎么办?——无线路由桥接(WDS)
背景 1.无线路由在客厅,房间的WIFI信号很差,只有1-2格,虽说是100M的网速,但是从客厅到房间要经过3道墙!电脑的无线接收功能一般都很一般,网速不好理所当然. 2.弄一根网线从客厅连接起来很傻 ...
- Jmeter_远程启动 I
Jmeter 是Java 应用,对于CPU和内存的消耗比较大,因此,当需要模拟数以千计的并发用户时,使用单台机器模拟所有的并发用户就有些力不从心,甚至会引起JAVA内存溢出错误. 其实,Jmeter的 ...
- 一个最简单的JStorm例子
最简单的JStorm例子分为以下几个步骤: 1.生成Topology Map conf = new HashMp(); //topology所有自定义的配置均放入这个Map TopologyBuild ...