flashinfer.tllm_enums.is_gated_activation¶
- flashinfer.tllm_enums.is_gated_activation(activation_type: int | ActivationType) bool¶
Return whether the given activation type is a gated activation (e.g. SwiGLU family).
Gated activations split their input along the feature dimension into a gate branch and a value branch; the two are combined element-wise before being passed to the next layer. This helper mirrors the C++
isGatedActivation()predicate defined ininclude/flashinfer/trtllm/fused_moe/runner.h.- Parameters:
activation_type (Union[int, ActivationType]) – The activation type to query. May be an
ActivationTypemember or its integer value.- Returns:
Trueifactivation_typebelongs to the gated activation family (Swiglu,Geglu,SwigluBias,SwigluStep,GegluTanh);Falseotherwise.- Return type:
bool
Examples
>>> from flashinfer.tllm_enums import ActivationType, is_gated_activation >>> is_gated_activation(ActivationType.Swiglu) True >>> is_gated_activation(ActivationType.Relu) False