vllm.model_executor.layers.fused_moe.router.custom_routing_router ¶
CustomRoutingRouter ¶
Bases: BaseRouter
Router using a custom user-provided routing function.
Source code in vllm/model_executor/layers/fused_moe/router/custom_routing_router.py
__init__ ¶
__init__(
top_k: int,
global_num_experts: int,
eplb_state: EplbLayerState,
custom_routing_function: Callable,
renormalize: bool = True,
enable_eplb: bool = False,
indices_type_getter: Callable[[], dtype | None]
| None = None,
)
Source code in vllm/model_executor/layers/fused_moe/router/custom_routing_router.py
_compute_routing ¶
_compute_routing(
hidden_states: Tensor,
router_logits: Tensor,
indices_type: dtype | None,
) -> tuple[Tensor, Tensor]
Compute routing using the custom routing function.