From fb5040a97556079d52f71a788b00428270284c7d Mon Sep 17 00:00:00 2001 From: Kaiyu Shi Date: Thu, 20 Jun 2019 11:48:26 -0700 Subject: [PATCH] Make pytorch1.0 happy --- weight_drop.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/weight_drop.py b/weight_drop.py index 60fda17..2e1e0f5 100644 --- a/weight_drop.py +++ b/weight_drop.py @@ -40,7 +40,7 @@ def _setweights(self): w = mask.expand_as(raw_w) * raw_w else: w = torch.nn.functional.dropout(raw_w, p=self.dropout, training=self.training) - setattr(self.module, name_w, w) + setattr(self.module, name_w, torch.nn.Parameter(w)) def forward(self, *args): self._setweights()