当前位置:网站首页>损失函数-交叉熵的原理及实现
损失函数-交叉熵的原理及实现
2022-07-28 00:23:00 【坠金】
咕咕咕~不催不更
什么是损失函数,损失函数的作用是?
有哪些常用的损失函数?数学表达式是什么?
实现
交叉熵的原理
实现
pytorch自带的交叉熵:
class CrossEntropyLoss(_WeightedLoss):
__constants__ = ['ignore_index', 'reduction']
ignore_index: int
def __init__(self, weight: Optional[Tensor] = None, size_average=None, ignore_index: int = -100,
reduce=None, reduction: str = 'mean') -> None:
super(CrossEntropyLoss, self).__init__(weight, size_average, reduce, reduction)
self.ignore_index = ignore_index
def forward(self, input: Tensor, target: Tensor) -> Tensor:
assert self.weight is None or isinstance(self.weight, Tensor)
return F.cross_entropy(input, target, weight=self.weight,
ignore_index=self.ignore_index, reduction=self.re边栏推荐
猜你喜欢

JS what situations can't use json Parse, json.stringify deep copy and a better deep copy method

HCIP第十二天笔记

Data security and privacy computing summit - provable security: Learning

Digital economy is the core of future economic development

Linux安装mysql8.0.29详细教程

Blizzard Diablo 4 ps5 / PS4 beta added to Playstation database

石油化工行业迎战涨价大潮,经销商分销系统平台数字化赋能经销商与门店

Prediction of charitable donation behavior by EEG multivariate model analysis

处理数据 给数据换名字

Niuke net question brushing training (III)
随机推荐
软件测试面试题:为什要在一个团队中开展测试工作?
JS数字精度丢失的原因及解决方案
Gbase 8C snapshot synchronization function
Collection / container
EEG多元模式分析预测慈善捐赠行为
GBase 8c 备份控制函数(三)
Hcip day 12 notes
2022软件测试技能 Robotframework + SeleniumLibrary + Jenkins web关键字驱动自动化实战教程
Gbase 8C backup control function (I)
以“数字化渠道”撬动家用电器消费蓝海,经销商在线系统让企业生意更进一步
基于 Flink CDC 实现海量数据的实时同步和转换
Gbase 8C backup control function (III)
GBase 8c 事务ID和快照(五)
Fiddler mobile packet capturing agent settings (for Huawei glory 60s)
Data warehouse construction - DWS floor
A Tiger's Tale
The storage cost is reduced by 80%. How does the cost management of youzan data middle office do?
ArcGIS:加载历史遥感影像
HyperMesh circular array - plug in
The petrochemical industry is facing the tide of rising prices, and the digital dealer distribution system platform enables dealers and stores