torch_npu.fast_gelu

API接口

torch_npu.fast_gelu(self) -> Tensor

功能描述

计算输入张量中fast_gelu的梯度。

参数说明

self (Tensor) - 数据类型:float16、float32。

示例

>>> x = torch.rand(2).npu()
>>> x
tensor([0.5991, 0.4094], device='npu:0')
>>> torch_npu.fast_gelu(x)
tensor([0.4403, 0.2733], device='npu:0')