1. 功能介绍
SoftMarginLoss是一种针对 two-class classification(二分类)问题的损失函数。
SoftMarginLoss creates a criterion that optimizes a two-class classification logistic loss between input tensor x and labels tensor y (containing 1 or -1).
2. 接口描述
Python层接口
接口目录:mindspore/ops/operations/nn_ops.py
class SoftMarginLoss(Primitive):
参数 | 类型 | 输入/输出/属性 | 说明 |
---|---|---|---|
reduction | str | 属性 | |
logits | Tensor | 输入 | |
labels | Tensor | 输入 | |
loss | Tensor | 输出 |
对应底层算子
Classify | Name | Type | Type Range | Required |
---|---|---|---|---|
INPUT | input_x | tensor | float, float16, double | TRUE |
INPUT | inpuy_y | tensor | float, float16, double | TRUE |
OUTPUT | output_z | tensor | float, float16, double | TRUE |
ATTR | redution | string | string | TRUE |
标杆接口参考
torch接口:
https://pytorch.org/docs/1.8.1/generated/torch.nn.SoftMarginLoss.html?highlight=softmarginloss
3. 异常处理
4. 算子反向
参考SoftMarginLoss算子
Please add labels (comp or sig), also you can visit https://gitee.com/mindspore/community/blob/master/sigs/dx/docs/labels.md to find more.
为了让代码尽快被审核,请您为Pull Request打上 组件(comp)或兴趣组(sig) 标签,打上标签的PR可以直接推送给责任人进行审核。
更多的标签可以查看https://gitee.com/mindspore/community/blob/master/sigs/dx/docs/labels.md
以组件相关代码提交为例,如果你提交的是data组件代码,你可以这样评论:
//comp/data
当然你也可以邀请data SIG组来审核代码,可以这样写:
//sig/data
另外你还可以给这个PR标记类型,例如是bugfix或者是特性需求:
//kind/bug or //kind/feature
恭喜你,你已经学会了使用命令来打标签,接下来就在下面的评论里打上标签吧!
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
登录 后才可以发表评论