Skip to content

Commit 0309f1f

Browse files
Merge pull request #6 from DubiousCactus/deepsource-autofix-50b0287c
refactor: merge `isinstance` calls
2 parents 59ce5f0 + 4c41730 commit 0309f1f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

utils/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def to_cuda_(x: Any) -> Union[Tuple, List, torch.Tensor, torch.nn.Module]:
5757
dtype = torch.float32 if dtype is torch.float64 else dtype
5858
else:
5959
return x
60-
if isinstance(x, torch.Tensor) or isinstance(x, torch.nn.Module):
60+
if isinstance(x, (torch.Tensor, torch.nn.Module)):
6161
x = x.to(device, dtype=dtype)
6262
elif isinstance(x, tuple):
6363
x = tuple(to_cuda_(t) for t in x)

0 commit comments

Comments
 (0)