Skip to content

Commit

Permalink
Fix deprecated usage of torch.nn.utils.weight_norm
Browse files Browse the repository at this point in the history
The previous implementation in darts.darts.models.forecasting.tcn_mode was using `torch.nn.utils.weight_norm`, which is deprecated in favor of `torch.nn.utils.parametrizations.weight_norm`. This commit replaces two occurrences of `torch.nn.utils.weight_norm` with the recommended `torch.nn.utils.parametrizations.weight_norm` to resolve the deprecation warning.
  • Loading branch information
SaeedForoutan committed May 18, 2024
1 parent 000d29d commit 42ef14a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions darts/models/forecasting/tcn_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ def __init__(
)
if weight_norm:
self.conv1, self.conv2 = (
nn.utils.weight_norm(self.conv1),
nn.utils.weight_norm(self.conv2),
nn.utils.parametrizations.weight_norm(self.conv1),
nn.utils.parametrizations.weight_norm(self.conv2),
)

if input_dim != output_dim:
Expand Down

0 comments on commit 42ef14a

Please sign in to comment.