For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).
Mojo function
gelu
def gelu[dtype: DType, simd_width: SIMDLength, accum: DType = get_accum_type[dtype]()](x: SIMD[dtype, simd_width]) -> SIMD[dtype, simd_width]
Compute the exact GELU activation using the equation .
Constraints:
Type must be a floating point Dtype.
Parameters:
- dtype (
DType): DType used for the computation. - simd_width (
SIMDLength): SIMD width used for the computation. - accum (
DType): Higher-precision accumulation dtype used internally; defaults toget_accum_type[dtype]().
Args:
- x (
SIMD[dtype, simd_width]): The value to compute the GELU operation on.
Returns:
SIMD[dtype, simd_width]: The result of the exact GELU operation.