当前位置:网站首页>The principle and implementation of loss function cross entropy
The principle and implementation of loss function cross entropy
2022-07-28 02:07:00 【Falling gold】
Cuckoo ~ No hurry, no change
What is the loss function , The function of the loss function is ?
What are the commonly used loss functions ? What is a mathematical expression ?
Realization
The principle of cross entropy
Realization
pytorch Self contained cross entropy :
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边栏推荐
猜你喜欢

BGP federal experiment
![[Taichi] draw a regular grid in Tai Chi](/img/48/14e825562afa3ffba96296799617f7.png)
[Taichi] draw a regular grid in Tai Chi

Redis设计规范

Digital economy is the core of future economic development

Packet capturing wizard netcapture app packet capturing tutorial "complete"

都在说DevOps,你真正了解它吗?

2022软件测试技能 Robotframework + SeleniumLibrary + Jenkins web关键字驱动自动化实战教程

2022 software testing skills robotframework + selenium library + Jenkins web Keyword Driven Automation practical tutorial

In the era of great changes in material enterprises, SRM supplier procurement system helps enterprises build a digital benchmark for property procurement

Solution of digital commerce cloud supply chain centralized purchase management system: centralized purchase system management mode, digital control of enterprise materials
随机推荐
Simplicity for beauty - programming ideas
Dpdk plug-in of VPP
GBase 8c 事务ID和快照(四)
对话Atlassian认证专家叶燕秀:Atlassian产品进入后Server时代,中国用户应当何去何从?
Five basic data structures of redis
软件测试面试题:请详细介绍一下各种测试类型的含义?
Gbase 8C transaction ID and snapshot
【面试:并发篇28:volatile】有序性
54:第五章:开发admin管理服务:7:人脸入库流程;人脸登录流程;浏览器开启视频调试模式(以便能够在本机的不安全域名的情况下,也能去开启摄像头);
Gbase 8C annotation information function
Zkrollup learning materials summary
Common modules of ros2 launch files
Vxe table/grid cell grouping and merging
学习了循环碰到了编写计算n的阶乘的题目,由此引发了一系列问题,包括一些初学者常见的坑,以及如何简化代码
uniapp 总结篇 (小程序)
GBase 8c 事务ID和快照(五)
Codeforces Round #807 (Div. 2) A-C题解
处理数据 给数据换名字
[Taichi] draw a regular grid in Tai Chi
synchronized详解