From 9fce9e5f1582168ceb606f775db498c072dbd8f5 Mon Sep 17 00:00:00 2001 From: Justee21 Date: Sun, 20 Sep 2026 16:46:26 -0400 Subject: [PATCH] Add eval call to full model loading example --- beginner_source/basics/saveloadrun_tutorial.py | 1 + 1 file changed, 1 insertion(+) diff --git a/beginner_source/basics/saveloadrun_tutorial.py b/beginner_source/basics/saveloadrun_tutorial.py index e80d32a6eaa..8683335baf9 100644 --- a/beginner_source/basics/saveloadrun_tutorial.py +++ b/beginner_source/basics/saveloadrun_tutorial.py @@ -63,6 +63,7 @@ # model, which is a legacy use case for ``torch.save``. model = torch.load('model.pth', weights_only=False) +model.eval() ######################## # .. note:: This approach uses Python `pickle `_ module when serializing the model, thus it relies on the actual class definition to be available when loading the model.