Skip to content

Commit

Permalink
Issue 651: Renamed hidden_size parameter in BlockRNNModel to hidden_d…
Browse files Browse the repository at this point in the history
…im (#1157)

* Issue 651: Renamed hidden_size parameter in BlockRNNModel to hidden_dim

* Issue 651: Renamed hidden_size parameter in BlockRNNModel to hidden_dim in tests, examples notebook
  • Loading branch information
mandar-avhad authored Aug 22, 2022
1 parent 20b3a29 commit f953005
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions darts/models/forecasting/block_rnn_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def __init__(
input_chunk_length: int,
output_chunk_length: int,
model: Union[str, nn.Module] = "RNN",
hidden_size: int = 25,
hidden_dim: int = 25,
n_rnn_layers: int = 1,
hidden_fc_sizes: Optional[List] = None,
dropout: float = 0.0,
Expand Down Expand Up @@ -162,8 +162,9 @@ def __init__(
Either a string specifying the RNN module type ("RNN", "LSTM" or "GRU"),
or a PyTorch module with the same specifications as
:class:`darts.models.block_rnn_model._BlockRNNModule`.
hidden_size
hidden_dim
Size for feature maps for each hidden RNN layer (:math:`h_n`).
In Darts version <= 0.21, hidden_dim was referred as hidden_size.
n_rnn_layers
Number of layers in the RNN module.
hidden_fc_sizes
Expand Down Expand Up @@ -321,7 +322,7 @@ def __init__(

self.rnn_type_or_module = model
self.hidden_fc_sizes = hidden_fc_sizes
self.hidden_size = hidden_size
self.hidden_dim = hidden_dim
self.n_rnn_layers = n_rnn_layers
self.dropout = dropout

Expand All @@ -346,7 +347,7 @@ def _create_model(self, train_sample: Tuple[torch.Tensor]) -> torch.nn.Module:
input_size=input_dim,
target_size=output_dim,
nr_params=nr_params,
hidden_dim=self.hidden_size,
hidden_dim=self.hidden_dim,
num_layers=self.n_rnn_layers,
num_layers_out_fc=hidden_fc_sizes,
dropout=self.dropout,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
BlockRNNModel,
{
"model": "RNN",
"hidden_size": 10,
"hidden_dim": 10,
"n_rnn_layers": 1,
"batch_size": 32,
"n_epochs": 10,
Expand Down
2 changes: 1 addition & 1 deletion examples/04-RNN-examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@
" model=\"GRU\",\n",
" input_chunk_length=125,\n",
" output_chunk_length=36,\n",
" hidden_size=10,\n",
" hidden_dim=10,\n",
" n_rnn_layers=1,\n",
" batch_size=32,\n",
" n_epochs=100,\n",
Expand Down

0 comments on commit f953005

Please sign in to comment.