Use euclidean distance for stop criterion

This commit is contained in:
Mattéo Delabre 2019-12-16 09:55:06 -05:00
parent 4f1514accf
commit 1d39184036
Signed by: matteo
GPG Key ID: AE3FBD02DC583ABB
1 changed files with 1 additions and 5 deletions

View File

@ -43,10 +43,6 @@ batch = 0
# Accumulated loss for last batches # Accumulated loss for last batches
running_loss = 0 running_loss = 0
# True in the first training phase where small batches are used, and false in
# the second phase where point positions are refined using large batches
is_coarse_optim = True
# List of training examples (not shuffled) # List of training examples (not shuffled)
classes_ordered = torch.arange(order).repeat(batch_size) classes_ordered = torch.arange(order).repeat(batch_size)
@ -84,7 +80,7 @@ while total_change >= 1e-4:
# Check for convergence # Check for convergence
model.eval() model.eval()
constellation = model.get_constellation() constellation = model.get_constellation()
total_change = (constellation - prev_constellation).abs().sum() total_change = (constellation - prev_constellation).norm(dim=1).sum()
prev_constellation = constellation prev_constellation = constellation
# Report loss # Report loss