moving tensors to GPU [v3]
This commit is contained in:
parent
017ec70783
commit
e563e1bf37
|
|
@ -74,7 +74,7 @@ class DCGRUCell(torch.nn.Module):
|
||||||
def _build_sparse_matrix(L):
|
def _build_sparse_matrix(L):
|
||||||
L = L.tocoo()
|
L = L.tocoo()
|
||||||
indices = np.column_stack((L.row, L.col))
|
indices = np.column_stack((L.row, L.col))
|
||||||
L = torch.sparse_coo_tensor(indices.T, L.data, L.shape)
|
L = torch.sparse_coo_tensor(indices.T, L.data, L.shape, device=device)
|
||||||
return L
|
return L
|
||||||
# return torch.sparse.sparse_reorder(L)
|
# return torch.sparse.sparse_reorder(L)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue