torch.nn.SmoothL1Loss()和smooth_l1_loss()怎么使用
发表于:2025-12-03 作者:千家信息网编辑
千家信息网最后更新 2025年12月03日,这篇文章主要介绍"torch.nn.SmoothL1Loss()和smooth_l1_loss()怎么使用",在日常操作中,相信很多人在torch.nn.SmoothL1Loss()和smooth_l
千家信息网最后更新 2025年12月03日torch.nn.SmoothL1Loss()和smooth_l1_loss()怎么使用
这篇文章主要介绍"torch.nn.SmoothL1Loss()和smooth_l1_loss()怎么使用",在日常操作中,相信很多人在torch.nn.SmoothL1Loss()和smooth_l1_loss()怎么使用问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答"torch.nn.SmoothL1Loss()和smooth_l1_loss()怎么使用"的疑惑有所帮助!接下来,请跟着小编一起来学习吧!
Microsoft Windows [版本 10.0.18363.1256](c) 2019 Microsoft Corporation。保留所有权利。C:\Users\chenxuqi>conda activate ssd4pytorch2_2_0(ssd4pytorch2_2_0) C:\Users\chenxuqi>pythonPython 3.7.7 (default, May 6 2020, 11:45:54) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32Type "help", "copyright", "credits" or "license" for more information.>>> import torch>>> import torch.nn.functional as F>>> input = torch.zeros(2,3)>>> inputtensor([[0., 0., 0.],[0., 0., 0.]])>>> target = torch.tensor([[0.5,1.2,0.8],[0.4,1.5,2.2]])>>> targettensor([[0.5000, 1.2000, 0.8000],[0.4000, 1.5000, 2.2000]])>>>>>> F.smooth_l1_loss(target, input, size_average=False)D:\Anaconda3\envs\ssd4pytorch2_2_0\lib\site-packages\torch\nn\_reduction.py:43: UserWarning: size_average and reduce args will be deprecated, please use reduction='sum' instead. warnings.warn(warning.format(ret))tensor(3.9250)>>> F.smooth_l1_loss(target, input, size_average=True)D:\Anaconda3\envs\ssd4pytorch2_2_0\lib\site-packages\torch\nn\_reduction.py:43: UserWarning: size_average and reduce args will be deprecated, please use reduction='mean' instead. warnings.warn(warning.format(ret))tensor(0.6542)>>> 3.9250/6.00.6541666666666667>>>>>>>>>>>> F.smooth_l1_loss(target, input, reduction = 'sum')tensor(3.9250)>>>>>> F.smooth_l1_loss(target, input, reduction='mean')tensor(0.6542)>>>>>> F.smooth_l1_loss(target, input, reduction='none')tensor([[0.1250, 0.7000, 0.3200],[0.0800, 1.0000, 1.7000]])>>>>>> inputtensor([[0., 0., 0.],[0., 0., 0.]])>>> targettensor([[0.5000, 1.2000, 0.8000],[0.4000, 1.5000, 2.2000]])>>>>>>>>>
到此,关于"torch.nn.SmoothL1Loss()和smooth_l1_loss()怎么使用"的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注网站,小编会继续努力为大家带来更多实用的文章!
学习
更多
帮助
实用
接下来
文章
方法
权利
版本
理论
知识
篇文章
网站
资料
跟着
问题
好用
实践
解答
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
小学生网络安全知识作文征文
大文本存储用什么数据库
网络安全答题满分图片
宁夏护苗网络安全进课堂
河南wms软件开发
软件开发这个专业
数据库 表 字段
steam裸连国内服务器
金沙网络安全和信息化委员会
caxa工程知识管理服务器
云服务器的网络是wifi吗
起床服务器ip
郑州中航软件开发有限公司客服
域控服务器如何防护
网络安全应知应会题
连接服务器对本机电脑也有要求
杰控组态如何建立数据库配方
网络安全个人重要性
网络技术发展4个阶段
网络安全法培训 通知
苹果服务器瘫痪什么时候恢复
互联网科技 保险
国家网络安全宣传周保护个人信息
数据库中文件怎样传到电脑
淘宝网页显示找不到服务器
企业官网数据库表设计
没有被分析的数据库
计算机网络技术专业能当海军吗
我的世界多人超大服务器
系统需求分析包括数据库设计