Skip to content

Commit

Permalink
address pytorch 1.9 deprecations (symeig, //) (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
akshayka authored Jun 21, 2021
1 parent 62914bc commit faee622
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pymde/constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def initialization(self, n_items, embedding_dim, device=None):
X -= X.mean(axis=0)
if not isinstance(n_items, torch.Tensor):
n_items = torch.tensor(n_items, dtype=X.dtype, device=device)
lmbda, Q = torch.symeig(X.T @ X, eigenvectors=True)
lmbda, Q = torch.linalg.eigh(X.T @ X, UPLO="U")
X = X @ Q @ torch.diag(lmbda ** (-0.5)) * (n_items.type(X.dtype).sqrt())
return X

Expand Down
2 changes: 1 addition & 1 deletion pymde/problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def __init__(
edges = edges.to(self.device)
p = torch.tensor(edges.shape[0], device=self.device)

complete_graph_edges = n_items * (n_items - 1) // 2
complete_graph_edges = (n_items * (n_items - 1) / 2).long()
if p is not None and p > complete_graph_edges:
raise ValueError(
"Your graph has more than (n_items choose 2) edges."
Expand Down

0 comments on commit faee622

Please sign in to comment.