UserWarning: Implicit dimension choice for softmax has been deprecated.
import torch.nn.functional as F
output = F.softmax(output)UserWarning: Implicit dimension choice for softmax has been deprecated. Change the call toinclude dim=X as an argument.
这个警告的原因是softmax()
函数已经被弃用了,虽然程序还是可以运行成功,但是这个做法不被pytorch所赞成。这个写法在早期的pytorch版本是没有警告的,现在因为其他考虑,要加上有指明dim参数。
改成
F.softmax(output, dim=1)
tensor([[0.5193, 0.4807],[0.6070, 0.3930],[0.5254, 0.4746],[0.5079, 0.4921],[0.4623, 0.5377],[0.4403, 0.5597],[0.5240, 0.4760],[0.4703, 0.5297],[0.5091, 0.4909],[0.4201, 0.5799],[0.5543, 0.4457],[0.5524, 0.4476],[0.5861, 0.4139],[0.5524, 0.4476],[0.5112, 0.4888],[0.4453, 0.5547]])
dim=某个数字,这个数字可以根据自己的需要更改。
Python-F.softmax(dim)中dim使用理解
UserWarning: Implicit dimension choice for softmax has been deprecated.相关推荐
- 解决pytorch softmax警告UserWarning: Implicit ....Change the call to include dim=X as an argument.
完整的警告为:UserWarning: Implicit dimension choice for softmax has been deprecated. Change the call to in ...
- 解决RuntimeError: cuda runtime error (30) : unknown error at /pytorch/aten/src/THC/THCGeneral.cpp:70N
解决两个问题: (1)RuntimeError: cuda runtime error (30) : unknown error at /pytorch/aten/src/THC/THCGeneral ...
- pyTorch 图像分类模型训练教程
pyTorch 图像识别教程 代码: https://github.com/dwSun/classification-tutorial.git 这里以 TinyMind <汉字书法识别>比 ...
- 运行 WuJie1010/Facial-Expression-Recognition.Pytorch 的 代码
运行 WuJie1010/Facial-Expression-Recognition.Pytorch 的 代码 通过 idea 打开,这些依赖全部都用最新的,直接让idea 解决依赖就行了,py用的是 ...
- 人头识别-人群中准确快速的检测头部算法
参考链接:https://blog.csdn.net/hahabeibei123456789/article/details/94720745 来自霍尼韦尔的资深数据科学家Aditya Vora分享了 ...
- pytorch nn.Softmax
应用 m = nn.Softmax(dim=1) input = torch.randn(2, 3) output = m(input) 概念 API 将多个输出值转换为概率值,范围在[0,1],且概 ...
- pytorch中tf.nn.functional.softmax(x,dim = -1)对参数dim的理解
torch.nn.functional.Softmax(input,dim=None) tf.nn.functional.softmax(x,dim = -1)中的参数dim是指维度的意思,设置这个参 ...
- 【Pytorch】| Pytorch中softmax的dim的详细总结
[Pytorch]| Pytorch中softmax的dim的详细总结 关于softmax的理解 一维向量:dim=0和dim=-1结果相同,dim=1和dim=2会报错 二维张量:dim=1和dim ...
- KLD Loss( tf.nn.softmax, torch.nn.functional.softmax, log_softmax, kl_div) 计算技巧(一)
最近在比较不同模型的性能,发现虽然文献中使用的相同的指标,比如KLD.但是数据的处理方式却存在着差异,这会导致最后的数据并不具有直接可比性. 这里记录下,其中的一些值得记住的细节.主要涉及的API包括 ...
最新文章
- 水稻微生物组时间序列分析3-冲击图展示时间序序列变化
- 容器开启数据服务之旅系列(四):Kubernetes QoS 助力在线运用与大数据离线运用的带宽控制和磁盘控制...
- 解决Android studio 非法字符的问题
- Python入门100题 | 第035题
- MongoDB 基础用法及学习笔记
- mysql存中文_mysql数据库存储中文数据的解决办法
- Hibernate工作原理(1)
- 【java web】java执行预编译Groovy脚本
- linux删除命令_【小技巧】Linux命令的快捷键
- High Availability手册(3): 配置
- Visio 2016软件
- 计算机操作系统复习题
- 【OpenCV】“帧差法”实现移动物体的检测(车辆识别)
- vue项目中使用百度离线地图(最新全面爬坑版)
- SQL Server 查询出金额转换为大写
- 全国医疗卫生信息化公司网址大全
- 计算机磁盘管理没有打开方式,Win10系统双击磁盘和文件夹打不开提示没有与之关联的程序怎么办...
- android item弹出popupwindow recycleview_PopupWindow+RecyclerView实现上下滑动框功能
- 在局域网内主动封堵BT下载使用
- Unity摄像机拍照并显示在小窗口里(RenderTexture和RawImage将摄像机图像渲染到GUI屏幕上小图显示)