refactor analysis.py

This commit is contained in:
ltcptgeneral 2018-12-20 15:05:43 -06:00
parent 188a7bbf1f
commit 7b1e54eed8
2 changed files with 1 additions and 2 deletions

View File

@ -145,9 +145,8 @@ class error(ValueError):
def _init_device (setting, arg): #initiates computation device for ANNs def _init_device (setting, arg): #initiates computation device for ANNs
if setting == "cuda": if setting == "cuda":
temp = setting + ":" + str(arg)
try: try:
return torch.device(temp if torch.cuda.is_available() else "cpu") return torch.device(setting + ":" + str(arg) if torch.cuda.is_available() else "cpu")
except: except:
raise error("could not assign cuda or cpu") raise error("could not assign cuda or cpu")
elif setting == "cpu": elif setting == "cpu":