Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] All_gather support tensor on cpu #6416

Merged
merged 9 commits into from
Mar 10, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rename function
  • Loading branch information
tchaton committed Mar 9, 2021
commit eea26a0b1354c6f6779dc4c086d387abd147852c
4 changes: 2 additions & 2 deletions pytorch_lightning/utilities/apply_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,10 @@ def convert_to_tensors(data, device: torch.device = None):
for src_dtype, conversion_func in CONVERSION_DTYPES:
data = apply_to_collection(data, src_dtype, partial(conversion_func, device=device))

def _move_to_device_and_contiguous(t: torch.Tensor, device: torch.device):
def _move_to_device_and_make_contiguous(t: torch.Tensor, device: torch.device):
if t.device != device:
t = t.to(device)
return t.contiguous()

data = apply_to_collection(data, torch.Tensor, partial(_move_to_device_and_contiguous, device=device))
data = apply_to_collection(data, torch.Tensor, partial(_move_to_device_and_make_contiguous, device=device))
return data