MCPcopy Create free account
hub / github.com/PaddlePaddle/FastDeploy / AllPool

Class AllPool

fastdeploy/model_executor/layers/pooler.py:365–378  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

363
364
365class AllPool(PoolingMethod):
366 def get_supported_tasks(self) -> Set[PoolingTask]:
367 return {"encode"}
368
369 def forward_all(
370 self,
371 hidden_states: paddle.Tensor,
372 pooling_cursor: PoolingCursor,
373 ) -> Union[list[paddle.Tensor], paddle.Tensor]:
374
375 assert not pooling_cursor.is_partial_prefill(), "partial prefill not supported with ALL pooling"
376 hidden_states_lst = list(hidden_states.split(pooling_cursor.num_scheduled_tokens_cpu.tolist()))
377
378 return [hidden_states_lst[i] for i in pooling_cursor.index]
379
380
381class MeanPool(PoolingMethod):

Callers 4

from_pooling_typeMethod · 0.85
__init__Method · 0.85

Calls

no outgoing calls