vllm.model_executor.layers.fused_moe.fused_moe_router ¶
FusedMoERouter ¶
Bases: ABC
FusedMoERouter is an abstract class that provides a 'select_experts' method that is used for routing hidden states based on router logits.
Source code in vllm/model_executor/layers/fused_moe/fused_moe_router.py
select_experts abstractmethod ¶
Route the input hidden states to the top-k experts based on the router logits.
Returns:
| Type | Description |
|---|---|
Tensor | (topk_weights, topk_ids) |
tuple[Tensor, Tensor] | |
tuple[Tensor, Tensor] | The weights and expert ids computation result. |
tuple[Tensor, Tensor] | Compatibility: When EPLB is not enabled, the returned ids are |
tuple[Tensor, Tensor] | equivalent to global logical ids, so should be compatible with |
tuple[Tensor, Tensor] | plain MoE implementations without redundant experts. |