Use euclidean distance for stop criterion
This commit is contained in:
parent
4f1514accf
commit
1d39184036
6
train.py
6
train.py
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue