From 843bb04b4d2fbe749a98a2a2b8684ffb8578402b Mon Sep 17 00:00:00 2001 From: halak0013 Date: Sun, 11 May 2025 15:47:26 +0300 Subject: [PATCH] bug fix: remove unnecessary device transfer in ResNet101 instantiation --- ML/Pytorch/CNN_architectures/pytorch_resnet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ML/Pytorch/CNN_architectures/pytorch_resnet.py b/ML/Pytorch/CNN_architectures/pytorch_resnet.py index c0d2c632..ae2b75e0 100644 --- a/ML/Pytorch/CNN_architectures/pytorch_resnet.py +++ b/ML/Pytorch/CNN_architectures/pytorch_resnet.py @@ -165,7 +165,7 @@ def ResNet152(img_channel=3, num_classes=1000): def test(): BATCH_SIZE = 4 device = torch.device("cuda" if torch.cuda.is_available() else "cpu") - net = ResNet101(img_channel=3, num_classes=1000).to(device) + net = ResNet101(img_channel=3, num_classes=1000) y = net(torch.randn(BATCH_SIZE, 3, 224, 224)).to(device) assert y.size() == torch.Size([BATCH_SIZE, 1000]) print(y.size())