Skip to content

Commit

Permalink
fix CUDA with MDS
Browse files Browse the repository at this point in the history
  • Loading branch information
lucidrains committed Feb 3, 2021
1 parent 5f9355b commit 8fc6d12
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions alphafold2_pytorch/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,8 @@ def mds_torch(pre_dist_mat, weights=None, iters=10, tol=1e-5, verbose=2):
* best_3d_coords: (3 x N)
* historic_stress
"""
device = pre_dist_mat.device

if weights is None:
weights = torch.ones_like(pre_dist_mat)
# batched MDS
Expand All @@ -271,8 +273,8 @@ def mds_torch(pre_dist_mat, weights=None, iters=10, tol=1e-5, verbose=2):
batch, N, _ = pre_dist_mat.shape
his = []
# init random coords
best_stress = float("Inf") * torch.ones(batch)
best_3d_coords = 2*torch.rand(batch, N, 3) - 1
best_stress = float("Inf") * torch.ones(batch, device = device)
best_3d_coords = 2*torch.rand(batch, N, 3, device = device) - 1
# iterative updates:
for i in range(iters):
# compute distance matrix of coords and stress
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
setup(
name = 'alphafold2-pytorch',
packages = find_packages(),
version = '0.0.6',
version = '0.0.7',
license='MIT',
description = 'AlphaFold2 - Pytorch',
author = 'Phil Wang, Eric Alcaide',
Expand Down

0 comments on commit 8fc6d12

Please sign in to comment.