mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2025-12-27 17:50:53 +08:00
[TPU] Skip creating empty tensor (#7630)
This commit is contained in:
parent
bbf55c4805
commit
ce143353c6
@ -271,7 +271,10 @@ def _make_src_to_dst(
|
||||
mapping: List[Tuple[int, int]],
|
||||
src_device: Union[torch.device, str],
|
||||
dst_device: Union[torch.device, str],
|
||||
) -> Tuple[torch.Tensor, torch.Tensor]:
|
||||
) -> Optional[Tuple[torch.Tensor, torch.Tensor]]:
|
||||
if not mapping:
|
||||
return None
|
||||
|
||||
src_indices = [i for i, _ in mapping]
|
||||
dst_indices = [i for _, i in mapping]
|
||||
src_indices = torch.tensor(src_indices,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user