Commit e2ff9075 authored by Hubert Nourtel's avatar Hubert Nourtel
Browse files

Fix loss calculation for cross-validation

parent 0330ec8b
......@@ -1131,7 +1131,7 @@ def cross_validation(model, validation_loader, device, validation_shape, tar_ind
if not isinstance(data, dict): # not using data_loading_hook
data = data.squeeze().to(device)
with torch.cuda.amp.autocast(enabled=mixed_precision):
(_loss, cce_prediction), batch_embeddings = model(data, target=None)
(_loss, cce_prediction), batch_embeddings = model(data, target=target)
accuracy += (torch.argmax(cce_prediction.data, 1) == target).sum().cpu()
loss += _loss
embeddings[cursor:cursor + batch_size,:] = batch_embeddings.detach().cpu()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment