Skip to content

Commit e7c23de

Browse files
author
Longbin Tang
authored
Fix device assignment in SystemCfg to ensure valid device initialization (#11)
1 parent 737f7c9 commit e7c23de

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

torchcontrol/system/system_cfg.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"""
55
from __future__ import annotations
66

7+
import torch
78
from dataclasses import MISSING, dataclass
89
from .system_base import SystemBase
910

@@ -47,4 +48,4 @@ def __post_init__(self):
4748
assert self.state_dim > 0, "state_dim must be greater than 0"
4849
assert self.action_dim > 0, "action_dim must be greater than 0"
4950
assert self.dt > 0, "dt must be greater than 0"
50-
assert self.device in ["cpu", "cuda"], "device must be 'cpu' or 'cuda'"
51+
self.device = torch.device(self.device)

0 commit comments

Comments
 (0)