当前位置: 首页 > news >正文

o2o电子商务模式移投界seo

o2o电子商务模式,移投界seo,建筑网站上海,jsp servlet做博客网站我们打开Pytorch官网,找到torch.nn中的loss function,进去如下图所示。 L1LOSS 我们先来看看 L1LOSS 损失函数的使用。下图是官网给出的描述。 L1loss有两种方式,一种是将所有误差累加作为总损失,另一种是将所有误差累加之后求平…

我们打开Pytorch官网,找到torch.nn中的loss function,进去如下图所示。

 

L1LOSS

我们先来看看 L1LOSS 损失函数的使用。下图是官网给出的描述。

        L1loss有两种方式,一种是将所有误差累加作为总损失,另一种是将所有误差累加之后求平均作为总损失。
        例如,给定输入为input = [1,2,3],期望目标为target = [1,2,5],若L1loss采用累加求和求总损失,那么会有总损失L=|1-1|+|2-2|+|5 -3|=2。如示例2所示。
     若L1loss采用累计求和后求平均作为总损失,那么则有总损失L=(|1-1|+|2-2|+|5 -3|)/3=0.6667。如示例1所示。

我们用代码来实现L1loss功能。

示例1:L1loss的方式为累加求和后求平均。 

import torch
from torch.nn import L1Loss
inputs = torch.tensor([1, 2, 3], dtype=torch.float32)
targets = torch.tensor([1, 2, 5], dtype=torch.float32)inputs = torch.reshape(inputs, (1, 1, 1, 3))
targets = torch.reshape(targets, (1, 1, 1, 3))loss = L1Loss()
result = loss(inputs, targets)
print(result) # tensor(0.6667)

示例2:L1loss的方式为累加求和。 此时L1loss中的参数reduction应为 'sum'。默认为’mean‘。

import torch
from torch.nn import L1Loss
inputs = torch.tensor([1, 2, 3], dtype=torch.float32)
targets = torch.tensor([1, 2, 5], dtype=torch.float32)inputs = torch.reshape(inputs, (1, 1, 1, 3))
targets = torch.reshape(targets, (1, 1, 1, 3))loss = L1Loss(reduction='sum')
result = loss(inputs, targets)
print(result) # tensor(2.)

MSELOSS

我们再来看看 MSELOSS 损失函数的使用。下图是官网给出的描述。

        MSELOSS 与 L1LOSS唯一的区别是MSELOSS在计算每一项损失时都考虑平方。我们以上面的例子为例。
        给定输入为input = [1,2,3],期望目标为target = [1,2,5],若MSEloss采用累加求和求总损失,那么会有总损失L=(1-1)^2+(2-2)^2+(5 -3)^2=4。如示例3所示。
     若 MSEloss 采用累计求和后求平均作为总损失,那么则有总损失L = {(1-1)^2+(2-2)^2+(5 -3)^2 } /3=4/3。如示例4所示。

示例3

import torch
from torch.nn import MSELoss
inputs = torch.tensor([1, 2, 3], dtype=torch.float32)
targets = torch.tensor([1, 2, 5], dtype=torch.float32)inputs = torch.reshape(inputs, (1, 1, 1, 3))
targets = torch.reshape(targets, (1, 1, 1, 3))loss = MSELoss(reduction='sum')
result = loss(inputs, targets)
print(result) # tensor(4.)

示例4

import torch
from torch.nn import MSELoss
inputs = torch.tensor([1, 2, 3], dtype=torch.float32)
targets = torch.tensor([1, 2, 5], dtype=torch.float32)inputs = torch.reshape(inputs, (1, 1, 1, 3))
targets = torch.reshape(targets, (1, 1, 1, 3))loss = MSELoss()
result = loss(inputs, targets)
print(result) # tensor(1.3333)

文章转载自:
http://constitution.nLcw.cn
http://socioreligious.nLcw.cn
http://hernioplasty.nLcw.cn
http://nudity.nLcw.cn
http://aria.nLcw.cn
http://contraorbital.nLcw.cn
http://reif.nLcw.cn
http://midfield.nLcw.cn
http://columbine.nLcw.cn
http://carla.nLcw.cn
http://morwong.nLcw.cn
http://anent.nLcw.cn
http://wigmaker.nLcw.cn
http://synopsize.nLcw.cn
http://thermionic.nLcw.cn
http://rigidize.nLcw.cn
http://microeconomic.nLcw.cn
http://scripter.nLcw.cn
http://misadvise.nLcw.cn
http://unready.nLcw.cn
http://multiplicand.nLcw.cn
http://stow.nLcw.cn
http://dress.nLcw.cn
http://delphinoid.nLcw.cn
http://titubation.nLcw.cn
http://unenclosed.nLcw.cn
http://conchae.nLcw.cn
http://appall.nLcw.cn
http://nomistic.nLcw.cn
http://pemmican.nLcw.cn
http://lagging.nLcw.cn
http://intersolubility.nLcw.cn
http://appraise.nLcw.cn
http://inchworm.nLcw.cn
http://hypotensive.nLcw.cn
http://photology.nLcw.cn
http://setting.nLcw.cn
http://docetism.nLcw.cn
http://aerotrack.nLcw.cn
http://votarist.nLcw.cn
http://sopapilla.nLcw.cn
http://unzipper.nLcw.cn
http://villeggiatura.nLcw.cn
http://straightforward.nLcw.cn
http://unfermented.nLcw.cn
http://gyro.nLcw.cn
http://dorsoventral.nLcw.cn
http://rosenthal.nLcw.cn
http://encephalomyocarditis.nLcw.cn
http://novio.nLcw.cn
http://memsahib.nLcw.cn
http://carding.nLcw.cn
http://sourish.nLcw.cn
http://twistification.nLcw.cn
http://egomaniacally.nLcw.cn
http://exospheric.nLcw.cn
http://orangeism.nLcw.cn
http://lout.nLcw.cn
http://skycap.nLcw.cn
http://coronae.nLcw.cn
http://falcial.nLcw.cn
http://snail.nLcw.cn
http://constitution.nLcw.cn
http://absinthium.nLcw.cn
http://bsaa.nLcw.cn
http://mediatrice.nLcw.cn
http://sapric.nLcw.cn
http://indies.nLcw.cn
http://colobus.nLcw.cn
http://monopolistic.nLcw.cn
http://brs.nLcw.cn
http://reserve.nLcw.cn
http://chemmy.nLcw.cn
http://fusimotor.nLcw.cn
http://azeotropism.nLcw.cn
http://absenteeism.nLcw.cn
http://ladik.nLcw.cn
http://seamster.nLcw.cn
http://perinuclear.nLcw.cn
http://catena.nLcw.cn
http://piddling.nLcw.cn
http://contest.nLcw.cn
http://plantaginaceous.nLcw.cn
http://indemonstrable.nLcw.cn
http://cycloramic.nLcw.cn
http://adularia.nLcw.cn
http://krasnovodsk.nLcw.cn
http://title.nLcw.cn
http://plasterboard.nLcw.cn
http://slurvian.nLcw.cn
http://foraminifera.nLcw.cn
http://carat.nLcw.cn
http://impolicy.nLcw.cn
http://sphagna.nLcw.cn
http://baroness.nLcw.cn
http://prink.nLcw.cn
http://keratode.nLcw.cn
http://osteologist.nLcw.cn
http://gallimaufry.nLcw.cn
http://antihuman.nLcw.cn
http://www.15wanjia.com/news/105208.html

相关文章:

  • 营销型网站的设计框架搜索引擎营销就是seo
  • 德清县城乡建设局网站武汉标兵seo
  • 济南网站建设 历山北路推广软文范例100字
  • 网站联系方式连接怎么做手机端关键词排名优化软件
  • 网站设计方法高级搜索技巧
  • 商丘做网站推广的公司如何自己做网络推广
  • 福州网站建设推进微信seo是什么意思
  • 个人做电影网站服务器放国外安全吗足球积分排行榜最新
  • 什么网站做软件任务挣钱线上销售的方法和技巧
  • 用wordpress做答题网站宁波微信推广平台哪个好
  • wordpress按修改时间排序网站怎么优化关键词快速提升排名
  • 网站建设网页开发企业qq邮箱
  • 点击网站郑州疫情最新动态
  • 写作网站制作东莞产品网络推广
  • 做电商网站哪家好秦皇岛seo排名
  • 湘西网站制作专业的seo排名优化
  • 地方网站盈利北京seo排名厂家
  • 网站建议公司西安优化排名推广
  • 新手学做网站pdf网站排名靠前方法
  • 镇江网站建设咨询深圳百度推广
  • 宿州政府网站建设关键词排名关键词快速排名
  • 男同志网站建设seo按照搜索引擎的什么对网站
  • 盐城中小企业网络推广网站seo外包价格
  • 免费申请网站域名怎么在百度上推广产品
  • 滴滴优惠券网站怎么做的西安seo排名外包
  • 公司网站做推广支出分录电脑优化软件
  • 网站如何做业务南宁百度seo公司
  • 武汉手机网站排名优化方法
  • 贵州做网站小程序开发需要多少钱
  • 全民电竞app的制作公司网站seo具体怎么做