mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2026-06-03 13:37:56 +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]],
|
mapping: List[Tuple[int, int]],
|
||||||
src_device: Union[torch.device, str],
|
src_device: Union[torch.device, str],
|
||||||
dst_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]
|
src_indices = [i for i, _ in mapping]
|
||||||
dst_indices = [i for _, i in mapping]
|
dst_indices = [i for _, i in mapping]
|
||||||
src_indices = torch.tensor(src_indices,
|
src_indices = torch.tensor(src_indices,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user