From d07875659aa9ca8b092344a2ecc487d4b3309ff3 Mon Sep 17 00:00:00 2001 From: TheMemoryDealer <32904619+TheMemoryDealer@users.noreply.github.com> Date: Thu, 1 Jun 2023 22:47:44 +0100 Subject: [PATCH] Patch 3 (#2389) * Updates #836 as suggested in https://github.com/pytorch/pytorch/issues/16885#issuecomment-551779897 --- beginner_source/former_torchies/parallelism_tutorial.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/beginner_source/former_torchies/parallelism_tutorial.py b/beginner_source/former_torchies/parallelism_tutorial.py index 18c14c4316..a11d844e1b 100644 --- a/beginner_source/former_torchies/parallelism_tutorial.py +++ b/beginner_source/former_torchies/parallelism_tutorial.py @@ -53,7 +53,10 @@ def forward(self, x): class MyDataParallel(nn.DataParallel): def __getattr__(self, name): - return getattr(self.module, name) + try: + return super().__getattr__(name) + except AttributeError: + return getattr(self.module, name) ######################################################################## # **Primitives on which DataParallel is implemented upon:**