FilesLast commitLast update
15 days ago
2 months ago
18 days ago
4 months ago
18 days ago
4 months ago
18 days ago
18 days ago
18 days ago
17 days ago
README

SquaredRelu

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:

    The SquaredRelu function is a variant based on the standard Relu function. Its main feature is squaring the output of the Relu function, and it is often used as the activation function of a model.

  • Formula:

    yi=(Relu(xi))2y_i=(Relu(x_i))^2

    The formula of Relu is:

    Relu(xi)=max(0,xi)Relu(x_i)=max(0,x_i)

    where x is the input tensor, y is the output tensor, and i is the position index of the element in the tensor.

Parameters

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

Constraints

  • If the input value is NaN, the output is also NaN. If the input is Inf, the output is also Inf.
  • If the input is -Inf, the output is 0.
  • The input shape supports only 1 to 8 dimensions. An error is reported when the value is out of the range.
  • out supports non-contiguous tensors. The computation result is written to the logical view of out.

Invocation Description

Invocation method Invocation sample Description
aclnn invocation test_aclnn_squared_relu Invoke the SquaredRelu operator through the aclnnSquaredRelu API.
Graph-mode invocation - Invoke the SquaredRelu operator by building a graph through the operator IR.