FilesLast commitLast update
4 months ago
3 months ago
2 months ago
24 days ago
3 months ago
4 months ago
1 month ago
1 month ago
18 days ago
README

Softsign

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 √

Function

  • Operator function: completes the Softsign activation function computation, computing the softsign value elementwise for each element of the input tensor.

  • Formula:

    y=x1+∣x∣y = \frac{x}{1 + |x|}

    In the formula, xx is the input tensor, yy is the output tensor, and the output value range is (−1,1)(-1, 1).

  • Numerical properties: the formula is naturally numerically stable. The denominator 1+∣x∣≥11 + |x| \geq 1, there is no division-by-zero risk, and no epsilon protection is needed.

Parameters

Parameter name Input/Output/Attribute Description Data type Data format
x Input The input x in the formula, a tensor of any shape. FLOAT, FLOAT16, BFLOAT16 ND
y Output The output y in the formula, with a shape and dtype exactly matching input x, and a value range of (-1, 1). FLOAT, FLOAT16, BFLOAT16 ND

Constraints

  • Input dimension limit: the input tensor has no more than 8 dimensions, and 0-dimensional scalar inputs are supported.
  • Data type limit: only FLOAT, FLOAT16, and BFLOAT16 are supported; DOUBLE is not supported.
  • FP16/BF16 precision description: FP16 and BFLOAT16 types perform intermediate computation internally by casting to FP32 and then casting back to the original type, to guarantee computation precision.

Invocation Description

Invocation method Invocation sample Description
Graph-mode invocation test_geir_softsign Calls the Softsign operator by building the graph through the [operator IR](./op_graph/softsign_proto.h).