scalar_gelu_approximated_with_tanh Class — pytorch Architecture
Architecture documentation for the scalar_gelu_approximated_with_tanh class in Gelu.h from the pytorch codebase.
Entity Profile
Source Code
aten/src/ATen/native/cpu/Gelu.h lines 32–39
template <typename T>
T scalar_gelu_approximated_with_tanh(T x) {
using opmath_t = reduced_fp_to_float_t<T>;
auto x_float = reduced_fp_to_float(x);
auto x_cube = x_float * x_float * x_float;
auto inner = opmath_t(kGeluBeta) * (x_float + opmath_t(kGeluKappa) * x_cube);
return opmath_t(0.5) * x_float * (opmath_t(1) + std::tanh(inner));
}
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free