vllm.model_executor.layers.fused_moe.router.fused_topk_bias_router ¶
FusedTopKBiasRouter ¶
Bases: BaseRouter
Router using fused top-k with e_score_correction_bias.
Source code in vllm/model_executor/layers/fused_moe/router/fused_topk_bias_router.py
_compute_routing ¶
_compute_routing(
hidden_states: Tensor,
router_logits: Tensor,
indices_type: dtype | None,
*,
input_ids: Tensor | None = None,
) -> tuple[Tensor, Tensor]
Compute routing using fused top-k with bias.
Source code in vllm/model_executor/layers/fused_moe/router/fused_topk_bias_router.py
_topk_softplus_sqrt_torch ¶
_topk_softplus_sqrt_torch(
topk_weights: Tensor,
topk_indices: Tensor,
token_expert_indices: Tensor,
gating_output: Tensor,
renormalize: bool = False,
e_score_correction_bias: Tensor | None = None,
input_tokens: Tensor | None = None,
hash_indices_table: Tensor | None = None,
routed_scaling_factor: float = 1.0,
) -> tuple[Tensor, ...]
Pure PyTorch fallback for topk_softplus_sqrt (XPU/CPU).