Home / Class/ scalar_gelu Class — pytorch Architecture

scalar_gelu Class — pytorch Architecture

Architecture documentation for the scalar_gelu class in Gelu.h from the pytorch codebase.

Entity Profile

Source Code

aten/src/ATen/native/cpu/Gelu.h lines 61–66

template <typename T>
T scalar_gelu(T x) {
  using opmath_t = reduced_fp_to_float_t<T>;
  const auto kAlpha = opmath_t(M_SQRT1_2);
  return reduced_fp_to_float(x) * opmath_t(0.5) * (opmath_t(1) + std::erf(reduced_fp_to_float(x) * kAlpha));
}

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free