Skip to content

Commit f8f2077

Browse files
author
ThibaultGROUEIX
committed
update tensor.min to torch.min(tensor) in pythonic chamfer distance to fix #27
1 parent 8ee852c commit f8f2077

12 files changed

+12
-12
lines changed

inference/run_AE_AtlasNet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def distChamfer(a,b):
5353
rx = xx[:, diag_ind, diag_ind].unsqueeze(1).expand_as(xx)
5454
ry = yy[:, diag_ind, diag_ind].unsqueeze(1).expand_as(yy)
5555
P = (rx.transpose(2,1) + ry - 2*zz)
56-
return P.min(1)[0], P.min(2)[0]
56+
return torch.min(P, 1)[0], torch.min(P, 2)[0], torch.min(P, 1)[1], torch.min(P, 2)[1]
5757
# ========================================================== #
5858

5959
blue = lambda x:'\033[94m' + x + '\033[0m'

inference/run_AE_AtlasNet_sphere.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def distChamfer(a,b):
5353
rx = xx[:, diag_ind, diag_ind].unsqueeze(1).expand_as(xx)
5454
ry = yy[:, diag_ind, diag_ind].unsqueeze(1).expand_as(yy)
5555
P = (rx.transpose(2,1) + ry - 2*zz)
56-
return P.min(1)[0], P.min(2)[0]
56+
return torch.min(P, 1)[0], torch.min(P, 2)[0], torch.min(P, 1)[1], torch.min(P, 2)[1]
5757
# ========================================================== #
5858

5959
blue = lambda x:'\033[94m' + x + '\033[0m'

inference/run_AE_Baseline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def distChamfer(a,b):
5151
rx = xx[:, diag_ind, diag_ind].unsqueeze(1).expand_as(xx)
5252
ry = yy[:, diag_ind, diag_ind].unsqueeze(1).expand_as(yy)
5353
P = (rx.transpose(2,1) + ry - 2*zz)
54-
return P.min(1)[0], P.min(2)[0]
54+
return torch.min(P, 1)[0], torch.min(P, 2)[0], torch.min(P, 1)[1], torch.min(P, 2)[1]
5555
# ========================================================== #
5656

5757
blue = lambda x:'\033[94m' + x + '\033[0m'

inference/run_SVR_AtlasNet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def distChamfer(a,b):
5353
rx = xx[:, diag_ind, diag_ind].unsqueeze(1).expand_as(xx)
5454
ry = yy[:, diag_ind, diag_ind].unsqueeze(1).expand_as(yy)
5555
P = (rx.transpose(2,1) + ry - 2*zz)
56-
return P.min(1)[0], P.min(2)[0]
56+
return torch.min(P, 1)[0], torch.min(P, 2)[0], torch.min(P, 1)[1], torch.min(P, 2)[1]
5757
# ========================================================== #
5858

5959
blue = lambda x:'\033[94m' + x + '\033[0m'

inference/run_SVR_AtlasNet_sphere.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def distChamfer(a,b):
5353
rx = xx[:, diag_ind, diag_ind].unsqueeze(1).expand_as(xx)
5454
ry = yy[:, diag_ind, diag_ind].unsqueeze(1).expand_as(yy)
5555
P = (rx.transpose(2,1) + ry - 2*zz)
56-
return P.min(1)[0], P.min(2)[0]
56+
return torch.min(P, 1)[0], torch.min(P, 2)[0], torch.min(P, 1)[1], torch.min(P, 2)[1]
5757
# ========================================================== #
5858

5959
blue = lambda x:'\033[94m' + x + '\033[0m'

inference/run_SVR_Baseline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def distChamfer(a,b):
5050
rx = xx[:, diag_ind, diag_ind].unsqueeze(1).expand_as(xx)
5151
ry = yy[:, diag_ind, diag_ind].unsqueeze(1).expand_as(yy)
5252
P = (rx.transpose(2,1) + ry - 2*zz)
53-
return P.min(1)[0], P.min(2)[0]
53+
return torch.min(P, 1)[0], torch.min(P, 2)[0], torch.min(P, 1)[1], torch.min(P, 2)[1]
5454
# ========================================================== #
5555

5656
blue = lambda x:'\033[94m' + x + '\033[0m'

training/train_AE_AtlasNet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def distChamfer(a,b):
6262
rx = xx[:, diag_ind, diag_ind].unsqueeze(1).expand_as(xx)
6363
ry = yy[:, diag_ind, diag_ind].unsqueeze(1).expand_as(yy)
6464
P = (rx.transpose(2,1) + ry - 2*zz)
65-
return P.min(1)[0], P.min(2)[0]
65+
return torch.min(P, 1)[0], torch.min(P, 2)[0], torch.min(P, 1)[1], torch.min(P, 2)[1]
6666
# ========================================================== #
6767

6868
# =============DEFINE stuff for logs ======================================== #

training/train_AE_AtlasNet_sphere.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def distChamfer(a,b):
6363
rx = xx[:, diag_ind, diag_ind].unsqueeze(1).expand_as(xx)
6464
ry = yy[:, diag_ind, diag_ind].unsqueeze(1).expand_as(yy)
6565
P = (rx.transpose(2,1) + ry - 2*zz)
66-
return P.min(1)[0], P.min(2)[0]
66+
return torch.min(P, 1)[0], torch.min(P, 2)[0], torch.min(P, 1)[1], torch.min(P, 2)[1]
6767
# ========================================================== #
6868

6969

training/train_AE_Baseline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def distChamfer(a,b):
6363
rx = xx[:, diag_ind, diag_ind].unsqueeze(1).expand_as(xx)
6464
ry = yy[:, diag_ind, diag_ind].unsqueeze(1).expand_as(yy)
6565
P = (rx.transpose(2,1) + ry - 2*zz)
66-
return P.min(1)[0], P.min(2)[0]
66+
return torch.min(P, 1)[0], torch.min(P, 2)[0], torch.min(P, 1)[1], torch.min(P, 2)[1]
6767
# ========================================================== #
6868

6969
# =============DEFINE stuff for logs ======================================== #

training/train_SVR_AtlasNet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def distChamfer(a,b):
6565
rx = xx[:, diag_ind, diag_ind].unsqueeze(1).expand_as(xx)
6666
ry = yy[:, diag_ind, diag_ind].unsqueeze(1).expand_as(yy)
6767
P = (rx.transpose(2,1) + ry - 2*zz)
68-
return P.min(1)[0], P.min(2)[0]
68+
return torch.min(P, 1)[0], torch.min(P, 2)[0], torch.min(P, 1)[1], torch.min(P, 2)[1]
6969
# ========================================================== #
7070

7171
# =============DEFINE stuff for logs ======================================== #

0 commit comments

Comments
 (0)