From fb0622151fbc7f1bda44cf0c5599c3c303be3280 Mon Sep 17 00:00:00 2001 From: Vikas12911 <40533391+Vikas12911@users.noreply.github.com> Date: Sat, 10 Apr 2021 17:38:30 +0530 Subject: [PATCH] change the dimension of x Dimension of x is [128,1,28,28]. But x dimension should be [128,784] That's why it show :---- RuntimeError: mat1 dim 1 must match mat2 dim 0 --- ML/Pytorch/Basics/pytorch_lr_ratescheduler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ML/Pytorch/Basics/pytorch_lr_ratescheduler.py b/ML/Pytorch/Basics/pytorch_lr_ratescheduler.py index 8a342070..b5c8b468 100644 --- a/ML/Pytorch/Basics/pytorch_lr_ratescheduler.py +++ b/ML/Pytorch/Basics/pytorch_lr_ratescheduler.py @@ -91,7 +91,7 @@ def check_accuracy(loader, model): for x, y in loader: x = x.to(device=device) y = y.to(device=device) - + x=x.view(x.size(0),-1) scores = model(x) _, predictions = scores.max(1) num_correct += (predictions == y).sum()