Skip to content

Commit

Permalink
Update StreamflowExample-DI.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Yalan-Song authored Dec 1, 2023
1 parent 20e93e6 commit f701b32
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion example/StreamflowExample-DI.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
Action = [0]
gpuid = -1
torch.cuda.set_device(gpuid)
device = torch.cuda.current_device() if torch.cuda.is_available() else torch.device("cpu" )

# Set hyperparameters
EPOCH = 300
Expand Down Expand Up @@ -207,7 +208,7 @@
if flow_regime==0:
lossFun = RmseLoss()
elif flow_regime==1:
lossFun = NSELossBatch(np.nanstd(yTrain, axis=1))
lossFun = NSELossBatch(np.nanstd(yTrain, axis=1),device = device)
# the loaded loss should be consistent with the 'name' in optLoss Dict above for logging purpose
# update and write the dictionary variable to out folder for logging and future testing
masterDict = wrapMaster(out, optData, optModel, optLoss, optTrain)
Expand Down

0 comments on commit f701b32

Please sign in to comment.