Hello everyone.
I am using pytorch nn.DataParallel, but I cannot access any variables within may model with it (I will get AttributeError).
So, I make a wrapper like this:
class DataParallelWrapper(nn.DataParallel):
    def __getattr__(self, name):
        try:
            return super().__getattr__(name)
        except AttributeError:
            return getattr(self.module, name)

Being completely zero in how nn.DataParallel is being implemented, it raises a question.
Is this a safe approach?
If it matters, I am using PyTorch 1.1 (need to update code before upgrading to new shiny version).