Skip to content

Commit d078756

Browse files
Patch 3 (#2389)
* Updates #836 as suggested in pytorch/pytorch#16885 (comment)
1 parent e1ec4bd commit d078756

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

beginner_source/former_torchies/parallelism_tutorial.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ def forward(self, x):
5353

5454
class MyDataParallel(nn.DataParallel):
5555
def __getattr__(self, name):
56-
return getattr(self.module, name)
56+
try:
57+
return super().__getattr__(name)
58+
except AttributeError:
59+
return getattr(self.module, name)
5760

5861
########################################################################
5962
# **Primitives on which DataParallel is implemented upon:**

0 commit comments

Comments
 (0)