diff --git a/main_lincls.py b/main_lincls.py index cb9d51675..942c69744 100755 --- a/main_lincls.py +++ b/main_lincls.py @@ -493,7 +493,7 @@ def accuracy(output, target, topk=(1,)): res = [] for k in topk: - correct_k = correct[:k].view(-1).float().sum(0, keepdim=True) + correct_k = correct[:k].reshape(k*correct.shape[1]).float().sum(0, keepdim=True) res.append(correct_k.mul_(100.0 / batch_size)) return res diff --git a/main_moco.py b/main_moco.py index d7ea97359..defffd537 100755 --- a/main_moco.py +++ b/main_moco.py @@ -393,7 +393,7 @@ def accuracy(output, target, topk=(1,)): res = [] for k in topk: - correct_k = correct[:k].view(-1).float().sum(0, keepdim=True) + correct_k = correct[:k].reshape(k*correct.shape[1]).float().sum(0, keepdim=True) res.append(correct_k.mul_(100.0 / batch_size)) return res diff --git a/moco/__pycache__/__init__.cpython-38.pyc b/moco/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 000000000..7cbcaaf04 Binary files /dev/null and b/moco/__pycache__/__init__.cpython-38.pyc differ diff --git a/moco/__pycache__/builder.cpython-38.pyc b/moco/__pycache__/builder.cpython-38.pyc new file mode 100644 index 000000000..c26198526 Binary files /dev/null and b/moco/__pycache__/builder.cpython-38.pyc differ diff --git a/moco/__pycache__/loader.cpython-38.pyc b/moco/__pycache__/loader.cpython-38.pyc new file mode 100644 index 000000000..a1f4b09f5 Binary files /dev/null and b/moco/__pycache__/loader.cpython-38.pyc differ