昇腾社区首页
中文
注册
开发者
下载

(beta)torch_npu.contrib.module.LabelSmoothingCrossEntropy

产品支持情况

产品 是否支持
[object Object]Atlas A3 训练系列产品[object Object]
[object Object]Atlas A2 训练系列产品[object Object]
[object Object]Atlas 推理系列产品[object Object]
[object Object]Atlas 训练系列产品[object Object]

功能说明

使用NPU API进行LabelSmoothing Cross Entropy。

函数原型

[object Object]

参数说明

计算参数

  • num_classes (float):用于onehot的class数量。
  • smooth_factor (float):如果正在使用LabelSmoothing,请改为0.1([0, 1])。默认值为0。

计算输入

  • pred(Tensor):模型预测结果。
  • target(Tensor):真实标签。

返回值说明

Tensor

交叉熵计算结果。

调用示例

[object Object]