Skip to content

Commit e6a3ea7

Browse files
authored
[ENH] Suppress PyTorch deprecation warning: UserWarning: nn.init.constant is now deprecated in favor of nn.init.constant_ (sktime#1915)
Behavior remains the same (in-place initialization)
1 parent 4af8ed5 commit e6a3ea7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pytorch_forecasting/models/dlinear/_dlinear_v2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ def __init__(
102102

103103
def _weight_init(self, m: nn.Module):
104104
if isinstance(m, nn.Linear):
105-
nn.init.constant(m.weight.data, 1.0 / self.context_length)
105+
nn.init.constant_(m.weight.data, 1.0 / self.context_length)
106106
if m.bias is not None:
107-
nn.init.constant(m.bias.data, 0.0)
107+
nn.init.constant_(m.bias.data, 0.0)
108108

109109
def _init_network(self):
110110
"""

0 commit comments

Comments
 (0)