Skip to content

Commit

Permalink
fix projected coordinates dimensions
Browse files Browse the repository at this point in the history
  • Loading branch information
lucidrains committed Dec 19, 2020
1 parent 1727fec commit 9ccf7e6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,10 @@ def forward(self, x):
pdist = nn.PairwiseDistance(p = 2)

num_pixels = proj_coors_one.shape[0]
proj_coors_one_expanded = proj_coors_one[None, :].expand(num_pixels, num_pixels, -1).reshape(num_pixels * num_pixels, 2)
proj_coors_two_expanded = proj_coors_two[:, None].expand(num_pixels, num_pixels, -1).reshape(num_pixels * num_pixels, 2)

proj_coors_one_expanded = proj_coors_one[:, None].expand(num_pixels, num_pixels, -1).reshape(num_pixels * num_pixels, 2)
proj_coors_two_expanded = proj_coors_two[None, :].expand(num_pixels, num_pixels, -1).reshape(num_pixels * num_pixels, 2)

distance_matrix = pdist(proj_coors_one_expanded, proj_coors_two_expanded)
distance_matrix = distance_matrix.reshape(num_pixels, num_pixels)

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 = 'pixel-level-contrastive-learning',
packages = find_packages(),
version = '0.0.10',
version = '0.0.11',
license='MIT',
description = 'Pixel-Level Contrastive Learning',
author = 'Phil Wang',
Expand Down

0 comments on commit 9ccf7e6

Please sign in to comment.