Skip to content

Commit cd2dd9e

Browse files
committed
Fix PSO not using default device
1 parent 177c74e commit cd2dd9e

File tree

1 file changed

+1
-1
lines changed
  • src/evox/algorithms/so/pso_variants

1 file changed

+1
-1
lines changed

src/evox/algorithms/so/pso_variants/pso.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def __init__(
3939
:param device: The device to use for the tensors. Defaults to None.
4040
"""
4141
super().__init__()
42-
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
42+
device = torch.get_default_device() if device is None else device
4343
assert lb.shape == ub.shape and lb.ndim == 1 and ub.ndim == 1 and lb.dtype == ub.dtype
4444
self.pop_size = pop_size
4545
self.dim = lb.shape[0]

0 commit comments

Comments
 (0)