Skip to content

Patch for compatibility with PyTorch ≥1.9 - #1

Open
khanhvu207 wants to merge 1 commit into
AntixK:masterfrom
khanhvu207:master
Open

Patch for compatibility with PyTorch ≥1.9#1
khanhvu207 wants to merge 1 commit into
AntixK:masterfrom
khanhvu207:master

Conversation

@khanhvu207

Copy link
Copy Markdown

Hi,

This PR updates the SpectralSteinEstimator for compatibility with modern PyTorch 2.7. In particular, PyTorch ≥ 1.9 deprecates and removes torch.eig. This caused a runtime error when computing eigenvalues of the Gram matrix. The fix:

  1. Replace line 78:
eigen_vals, eigen_vecs = torch.eig(Kxx, eigenvectors=True)

with:

eigen_vals, eigen_vecs = torch.linalg.eig(Kxx)
eigen_vals = eigen_vals.real
eigen_vecs = eigen_vecs.real
  1. And replace eigen_vals[:, 0] with just eigen_vals.

@khanhvu207 khanhvu207 changed the title update: adapt to torch 2.7.0 Patch for compatibility with PyTorch ≥1.9 May 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant