models.modules.ConvLSTM

models.modules.ConvLSTM#

class ConvLSTM(in_channels: int, hidden_channels: int, kernel_size: int = 1, bias: bool = False)[source]#

Bases: Module

Convolutional LSTM

For more details, see ndrplz/ConvLSTM_pytorch.

Parameters:
  • in_channels (int) – Number of input channels.

  • hidden_channels (int) – Number of hidden channels.

  • kernel_size (int, optional) – Size of the convolving kernel. Defaults to 1.

  • bias (bool, optional) – If True, adds a learnable bias to the output. Defaults to False.

Methods

Attributes

training

forward(X: Tensor, state: Tuple[Tensor, Tensor] | None = None) Tuple[Tensor, Tuple[Tensor, Tensor]][source]#
Parameters:
  • X (torch.Tensor) – Input tensor. Shape [batch, channel, h, w].

  • state (Optional[Tuple[torch.Tensor, torch.Tensor]], optional) – Past state of the cell. Defaults to None. It is a list of the form: (hidden state, cell state).

Returns:

List of form: (next hidden state, (next hidden state, next cell state)).

Return type:

Tuple[torch.Tensor, Tuple[torch.Tensor, torch.Tensor]]