Skip to content

Commit

Permalink
Update utils.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhaoJ9014 committed Mar 20, 2019
1 parent c0a416b commit b48f4f3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions backup/utils.py
Expand Up @@ -167,7 +167,7 @@ def perform_val(multi_gpu, device, embedding_size, batch_size, backbone, carray,
embeddings = np.zeros([len(carray), embedding_size])
with torch.no_grad():
while idx + batch_size <= len(carray):
batch = torch.tensor(carray[idx:idx + batch_size])
batch = torch.tensor(carray[idx:idx + batch_size][:, [2, 1, 0], :, :])
if tta:
fliped = hflip_batch(batch)
emb_batch = backbone(batch.to(device)).cpu() + backbone(fliped.to(device)).cpu()
Expand Down Expand Up @@ -234,4 +234,4 @@ def accuracy(output, target, topk=(1,)):


def save_checkpoint(state, filename):
torch.save(state, filename)
torch.save(state, filename)

0 comments on commit b48f4f3

Please sign in to comment.