npu.ops.gelu

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas 200I/500 A2 inference product

Atlas inference product

Atlas training product

Description

Computes the GELU activation function. Each input tensor is multiplied by one P(X <= x), where P(X) follows N(0, 1).

Prototype

1
npu.ops.gelu(x)

Parameters

Parameter

Input/Output

Description

x

Input

Input tensor of type float.

Returns

Result tensor after the GELU operation is performed on input x. The data type is the same as the input.

Example

1
2
import npu_device as npu
output = npu.ops.gelu(x)