Skip to content

Commit

Permalink
Update simclr.py
Browse files Browse the repository at this point in the history
  • Loading branch information
sthalles authored Apr 18, 2020
1 parent df7500e commit c057471
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions simclr.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,14 @@ def _validate(self, model, valid_loader):
model.eval()

valid_loss = 0.0
for counter, ((xis, xjs), _) in enumerate(valid_loader):
counter = 0
for (xis, xjs), _ in valid_loader:
xis = xis.to(self.device)
xjs = xjs.to(self.device)

loss = self._step(model, xis, xjs, counter)
valid_loss += loss.item()

counter += 1
valid_loss /= counter
model.train()
return valid_loss

0 comments on commit c057471

Please sign in to comment.