FilesLast commitLast update
12 days ago
3 months ago
12 days ago
11 days ago
12 days ago
12 days ago
5 months ago
12 days ago
12 days ago
README

SoftsignGrad

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 backward gradient computation of the Softsign activation function. Given the upstream gradient gradients and the forward input features, it computes the output gradient element by element.

  • Computation formula:

    outputi=gradientsi(1+∣featuresi∣)2output_i = \frac{gradients_i}{(1 + |features_i|)^2}

    where:

    • gradients: upstream gradient tensor
    • features: input feature tensor of the Softsign forward function
    • output: computed gradient output tensor

Parameters

Parameter name Input/Output Description Data type Data format Non-contiguous Tensor
gradients Input Upstream gradient tensor, corresponding to gradients in the formula. It supports 0 to 8 dimensional tensors, dynamic shapes, and empty tensors. Its shape must be exactly the same as the shape of features. FLOAT, FLOAT16, BFLOAT16 ND ×
features Input Input feature tensor of the Softsign forward function, corresponding to features in the formula. It supports 0 to 8 dimensional tensors, dynamic shapes, and empty tensors. Its shape must be exactly the same as the shape of gradients. FLOAT, FLOAT16, BFLOAT16 ND ×
output Output Computed gradient output tensor, corresponding to output in the formula. Its shape is the same as the inputs, and its data type is consistent with the inputs. FLOAT, FLOAT16, BFLOAT16 ND ×

Constraints

  • The data types of gradients and features must be consistent, and only FLOAT, FLOAT16, and BFLOAT16 are supported.
  • The shapes of gradients and features must be exactly the same, and broadcasting is not supported.
  • Non-contiguous tensors (transposed or sliced views with strides, etc.) are not within the supported scope. The current version does not guarantee explicit interception or automatic conversion of non-contiguous inputs; callers should ensure that contiguous dense-layout tensors are passed in.
  • Only 0 to 8 dimensional tensors are supported. Violations of the dimension count, format (ND only), or dtype constraints are rejected in a controlled manner at the graph compilation/tiling stage (the kernel is not executed).
  • FP16/BF16 inputs are internally promoted to FP32 precision for the computation, and the results are converted back to the original precision.

Invocation Description

Invocation method Sample code Description
Graph mode test_geir_softsign_grad.cpp Invokes the SoftsignGrad operator in graph mode.