文件最后提交记录最后更新时间
3 个月前
2 个月前
2 个月前
2 个月前
2 个月前
2 个月前
4 个月前
2 个月前
README

SoftMarginLoss

产品支持情况

产品 是否支持
Ascend 950PR/Ascend 950DT √
Atlas A3 训练系列产品/Atlas A3 推理系列产品 √
Atlas A2 训练系列产品/Atlas A2 推理系列产品 √
Atlas 200I/500 A2 推理产品 ×
Atlas 推理系列产品 √
Atlas 训练系列产品 √

功能说明

  • 算子功能:计算输入self和目标target的二分类逻辑损失函数。
  • 计算公式:

当reduction为'none'时:

out(self,target)=L=log(1+exp⁡(−target[i]∗self[i]))\text{out}(self,target)=L=log(1+\exp(-target[i]*self[i]))

如果reduction为mean或sum时,

out(self,target)={mean(L),if reduction=’mean’sum(L),if reduction=’sum’\text{out}(self,target)=\begin{cases} mean(L), & \text{if reduction} = \text{'mean'}\\ sum(L), & \text{if reduction} = \text{'sum'} \end{cases}

  • 其中:
  • self: 输入张量
  • target: 真实标签

参数说明

参数名 输入/输出/属性 描述 数据类型 数据格式
self 输入 公式中的'self',表示输入张量。 BFLOAT16、FLOAT16、FLOAT32 ND
target 输入 公式中的'target',表示真实标签。 BFLOAT16、FLOAT16、FLOAT32 ND
loss 输出 表示self与target经soft_margin_loss计算得到的损失值输出 FLOAT16、BFLOAT16、FLOAT32 ND
reduction 属性 表示对逐元素损失值进行均值/求和/无归约的归约参数,支持'none'、'mean'、'sum' STRING -

约束说明

无。

调用说明

调用方式 样例代码 说明
aclnn接口 test_aclnn_soft_margin_loss.cpp 通过aclnnSoftMarginLoss接口方式调用SoftMarginLoss算子。