We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0bee138 commit 4b6497cCopy full SHA for 4b6497c
beginner_source/former_torchies/parallelism_tutorial.py
@@ -51,9 +51,12 @@ def forward(self, x):
51
# clashes in their names. For those who still want to access the attributes,
52
# a workaround is to use a subclass of ``DataParallel`` as below.
53
54
-class MyDataParallel(nn.DataParallel):
+class MyDataParallel(DataParallel):
55
def __getattr__(self, name):
56
- return getattr(self.module, name)
+ try:
57
+ return super().__getattr__(name)
58
+ except AttributeError:
59
+ return getattr(self.module, name)
60
61
########################################################################
62
# **Primitives on which DataParallel is implemented upon:**
0 commit comments