FilesLast commitLast update
12 days ago
12 days ago
12 days ago
12 days ago
12 days ago
12 days ago
12 days ago
2 months ago
16 days ago
12 days ago
README

Heaviside

English | 简体中文

Applicable Products

Product Support
Ascend 950PR&950DT products √
Atlas A3 products √
Atlas A2 products √
Atlas 200I/500 A2 inference products ×
Atlas inference products ×
Atlas training products ×
kirin X90 processor series products √
Kirin 9030 processor series products √

Function

  • Description: Computes the Heaviside step function of each element in the input input, serving as the activation function of the model.

  • Formula:

    Heaviside(input,values)={0,if input<0values,if input=01,if input>0\text{Heaviside}(\text{input}, \text{values}) = \begin{cases} 0, & \text{if input} < 0 \\ \text{values}, & \text{if input} = 0 \\ 1, & \text{if input} > 0 \end{cases}

Parameters

Parameter name Input/Output/Attribute Description Data type Data format
input Input Input input in the formula. BFLOAT16, FLOAT16, FLOAT ND
values Input Input values in the formula. BFLOAT16, FLOAT16, FLOAT ND
out Output Heaviside in the formula. BFLOAT16, FLOAT16, FLOAT ND
  • kirin X90 processor series products and Kirin 9030 processor series products: BFLOAT16 is not supported.

Constraints

  • The data types of input, values, and out must be consistent.
  • input supports 1~8 dims. When values is a single-element tensor (scalar), input additionally supports 0 dims (scalar).
  • values supports only the following two forms:
    • A single-element tensor (with a total element count of 1, processed as a scalar);
    • The exact same shape as input, with the total element counts of both input and values greater than 0 (graph mode does not support empty tensors with a total element count of 0).
  • In graph mode (operator IR), the kernel does not perform broadcast internally and reads values only as a scalar or at the same linear offset. Therefore, a general broadcast relationship between input and values is not supported (for example, input is a 0-dim scalar while values is a multi-dim tensor).

Invocation Description

Invocation method Invocation sample Description
aclnn invocation test_aclnn_heaviside Calls the Heaviside operator through the aclnnHeaviside interface.
Graph-mode invocation - Calls the Heaviside operator by constructing a graph through the operator IR.