Selu
产品支持情况
| 产品 | 是否支持 |
|---|---|
| Ascend 950PR/Ascend 950DT | √ |
| Atlas A3 训练系列产品/Atlas A3 推理系列产品 | √ |
| Atlas A2 训练系列产品/Atlas A2 推理系列产品 | √ |
| Atlas 200I/500 A2 推理产品 | × |
| Atlas 推理系列产品 | × |
| Atlas 训练系列产品 | √ |
功能说明
-
算子功能:对输入Tensor逐元素计算SELU(Scaled Exponential Linear Unit)激活函数。
-
计算公式:
SELU(x)=scale×(max(0,x)+min(0,α×(ex−1)))\text{SELU}(x) = \text{scale} \times \left( \max(0, x) + \min\left(0, \alpha \times \left(e^x - 1\right)\right) \right)
其中:
- α=1.6732632423543772848170429916717\alpha = 1.6732632423543772848170429916717
- scale=1.0507009873554804934193349852946\text{scale} = 1.0507009873554804934193349852946
分段行为:
- 当x>0x > 0时:SELU(x)=scale×x\text{SELU}(x) = \text{scale} \times x(线性区)
- 当x≤0x \le 0时:SELU(x)=scale×α×(ex−1)\text{SELU}(x) = \text{scale} \times \alpha \times (e^x - 1)(指数饱和区)
参数说明
| 参数名 | 输入/输出 | 描述 | 数据类型 | 数据格式 | 维度(shape) |
|---|---|---|---|---|---|
| x | 输入 | 公式中的输入x。 | FLOAT、FLOAT16、BFLOAT16、INT32、INT8 | ND | 1-8 |
| y | 输出 | 公式中的输出y,shape与输入x相同。 | FLOAT、FLOAT16、BFLOAT16、INT32、INT8 | ND | 1-8 |
约束说明
无
调用说明
| 调用方式 | 调用样例 | 说明 |
|---|---|---|
| aclnn调用 | test_aclnn_selu | 通过aclnnSelu&aclnnInplaceSelu接口方式调用Selu算子。 |
| aclnn调用 | test_aclnn_inplace_selu | 通过aclnnSelu&aclnnInplaceSelu接口方式调用Selu算子。 |