"vscode:/vscode.git/clone" did not exist on "9743d64e4e04a88174c76553fcbffa33a18c7db5"
Unverified Commit ce143353 authored by Woosuk Kwon's avatar Woosuk Kwon Committed by GitHub
Browse files

[TPU] Skip creating empty tensor (#7630)

parent bbf55c48
...@@ -271,7 +271,10 @@ def _make_src_to_dst( ...@@ -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,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment