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

ThresholdV2

产品支持情况

产品 是否支持
Ascend 950PR/Ascend 950DT

功能说明

  • 算子功能:对输入张量进行阈值判断,大于阈值的元素保持原值,小于等于阈值的元素替换为指定值。
  • 计算公式:

yi={xi,xi>thresholdvalue,xi≤thresholdy_i = \begin{cases} x_i, & x_i > \text{threshold} \\ \text{value}, & x_i \leq \text{threshold} \end{cases}

  • 计算示例:

Input=[1.0,2.0,0.5,3.0,−1.0,4.0],threshold=1.5,value=0.0\text{Input} = [1.0, 2.0, 0.5, 3.0, -1.0, 4.0], \text{threshold}=1.5, \text{value}=0.0

Output=[0.0,2.0,0.0,3.0,0.0,4.0]\text{Output} = [0.0, 2.0, 0.0, 3.0, 0.0, 4.0]

参数说明

参数名 输入/输出/属性 描述 数据类型 数据格式
self 输入 输入张量,公式中的x。 FLOAT、FLOAT16、BFLOAT16 ND
threshold 属性 阈值,用于判断条件 x > threshold。 FLOAT -
value 属性 替换值,当 x <= threshold 时,输出为 value。 FLOAT -
out 输出 输出张量,公式中的 y,与 self 的 shape 和数据类型一致。 FLOAT、FLOAT16、BFLOAT16 ND

约束说明

  • 输入张量 self 与输出张量 out 的 shape 必须一致。
  • threshold 和 value 为编译期/运行期常量,通过属性传入。
  • 仅支持 Ascend950 芯片。

调用说明

调用方式 调用样例 说明
aclnn调用 test_aclnn_threshold_v2 通过 aclnnThresholdV2GetWorkspaceSizeaclnnThresholdV2 接口方式调用。

贡献说明

贡献者 贡献方 贡献算子 贡献时间 贡献内容
liuyi 个人开发者 ThresholdV2 2026/04/28 ThresholdV2算子适配开源仓