Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ def forward(self, x):
f_in = x.contiguous().view(N, C * T, V)

adj_mat = None
self.A = self.A.cuda(x.get_device())
# x.get_device() returns -1 for a CPU tensor, and .cuda() forces CUDA
# regardless, so this raised "Device index must not be negative" on any
# machine without a GPU. .to() follows whichever device x is already on.
self.A = self.A.to(x.device)
adj_mat = self.B[:,:] + self.gamma * self.A[:,:]
adj_mat_min = torch.min(adj_mat)
adj_mat_max = torch.max(adj_mat)
Expand Down
5 changes: 4 additions & 1 deletion DK wind speed forecasting/WeatherGCNet/model_dk.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ def forward(self, x):
f_in = x.contiguous().view(N, C * T, V)

adj_mat = None
self.A = self.A.cuda(x.get_device())
# x.get_device() returns -1 for a CPU tensor, and .cuda() forces CUDA
# regardless, so this raised "Device index must not be negative" on any
# machine without a GPU. .to() follows whichever device x is already on.
self.A = self.A.to(x.device)
adj_mat = self.B[:,:] + self.A[:,:]
adj_mat_min = torch.min(adj_mat)
adj_mat_max = torch.max(adj_mat)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ def forward(self, x):
f_in = x.contiguous().view(N, C * T, V)

adj_mat = None
self.A = self.A.cuda(x.get_device())
# x.get_device() returns -1 for a CPU tensor, and .cuda() forces CUDA
# regardless, so this raised "Device index must not be negative" on any
# machine without a GPU. .to() follows whichever device x is already on.
self.A = self.A.to(x.device)
adj_mat = self.B[:,:] + self.gamma * self.A[:,:]
adj_mat_min = torch.min(adj_mat)
adj_mat_max = torch.max(adj_mat)
Expand Down
5 changes: 4 additions & 1 deletion NL wind speed forecasting/WeatherGCNet/model_nl.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ def forward(self, x):
f_in = x.contiguous().view(N, C * T, V)

adj_mat = None
self.A = self.A.cuda(x.get_device())
# x.get_device() returns -1 for a CPU tensor, and .cuda() forces CUDA
# regardless, so this raised "Device index must not be negative" on any
# machine without a GPU. .to() follows whichever device x is already on.
self.A = self.A.to(x.device)
adj_mat = self.B[:,:] + self.A[:,:]
adj_mat_min = torch.min(adj_mat)
adj_mat_max = torch.max(adj_mat)
Expand Down