文件最后提交记录最后更新时间
10 小时前
30 天前
14 天前
10 小时前
30 天前
5 小时前
5 小时前
5 小时前
2 个月前
13 天前
README

LeakyRelu

产品支持情况

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

功能说明

  • 接口功能:激活函数,用于解决Relu函数在输入小于0时输出为0的问题,避免神经元无法更新参数。

  • 计算公式:

    out=max(0,self)+negativeSlope∗min(0,self)out = max(0,self) + negativeSlope * min(0,self)

参数说明

参数名 输入/输出/属性 描述 数据类型 数据格式
self 输入 待进行LeakyRelu激活函数的入参,公式中的self。 FLOAT、FLOAT16、BFLOAT16 ND
negativeSlope 输入 表示self < 0时的斜率,公式中的negativeSlope。 FLOAT -
out 输出 待进行LeakyRelu激活函数的出参。 FLOAT、FLOAT16、BFLOAT16 ND
  • Atlas 训练系列产品:数据类型支持FLOAT、FLOAT16。

约束说明

  • negativeSlope使用整型类型作为属性输入,而输入self是FLOAT类型,那么如果negativeSlope大于2^24或小于-2^24可能存在精度损失。同理,如果输入self是FLOAT16类型,那么negativeSlope大于2^11或小于-2^11可能存在精度损失。

调用说明

调用方式 样例代码 说明
aclnn接口 test_aclnn_leaky_relu.cpp 通过aclnnLeakyRelu&aclnnInplaceLeakyRelu接口方式调用LeakyRelu算子。
aclnn接口 test_aclnn_inplace_leaky_relu.cpp 通过aclnnLeakyRelu&aclnnInplaceLeakyRelu接口方式调用LeakyRelu算子。