Skip to content

Commit

Permalink
Fixed device conversion method (#887)
Browse files Browse the repository at this point in the history
Co-authored-by: Boaz <bendboaz@gmail.com>
  • Loading branch information
bendboaz and Boaz committed Apr 5, 2020
1 parent 3d2be23 commit 5e05252
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ignite/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def convert_tensor(
"""Move tensors to relevant device."""

def _func(tensor: torch.Tensor) -> torch.Tensor:
return tensor.to(device=device, non_blocking=non_blocking) if device else tensor
return tensor.to(device=device, non_blocking=non_blocking) if device is not None else tensor

return apply_to_tensor(input_, _func)

Expand Down

0 comments on commit 5e05252

Please sign in to comment.