aihwkit.nn.modules.rnn.layers module¶
Analog RNN layers
- class aihwkit.nn.modules.rnn.layers.AnalogBidirRNNLayer(cell, *cell_args)[source]¶
Bases:
aihwkit.nn.modules.container.AnalogSequential
Bi-directional analog RNN layer.
- Parameters
cell (Type) – RNNCell type (AnalogLSTMCell/AnalogGRUCell/AnalogVanillaRNNCell)
cell_args (Any) – arguments to RNNCell (e.g. input_size, hidden_size, rpu_configs)
- forward(input_, states)[source]¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.- Parameters
input_ (torch.Tensor) –
states (List[Union[Tuple[torch.Tensor, torch.Tensor], torch.Tensor]]) –
- Return type
Tuple[torch.Tensor, List[Union[Tuple[torch.Tensor, torch.Tensor], torch.Tensor]]]
- class aihwkit.nn.modules.rnn.layers.AnalogRNNLayer(cell, *cell_args)[source]¶
Bases:
aihwkit.nn.modules.container.AnalogSequential
Analog RNN Layer.
- Parameters
cell (Type) – RNNCell type (AnalogLSTMCell/AnalogGRUCell/AnalogVanillaRNNCell/ AnalogLSTMCellSingleRPU)
cell_args (Any) – arguments to RNNCell (e.g. input_size, hidden_size, rpu_configs)
- forward(input_, state)[source]¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.- Parameters
input_ (torch.Tensor) –
state (Union[Tuple[torch.Tensor, torch.Tensor], torch.Tensor]) –
- Return type
Tuple[torch.Tensor, Tuple[torch.Tensor, torch.Tensor]]
- class aihwkit.nn.modules.rnn.layers.AnalogReverseRNNLayer(cell, *cell_args)[source]¶
Bases:
aihwkit.nn.modules.container.AnalogSequential
Analog RNN layer for direction.
- Parameters
cell (Type) – RNNCell type (AnalogLSTMCell/AnalogGRUCell/AnalogVanillaRNNCell)
cell_args (Any) – arguments to RNNCell (e.g. input_size, hidden_size, rpu_configs)
- forward(input_, state)[source]¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.- Parameters
input_ (torch.Tensor) –
state (Union[Tuple[torch.Tensor, torch.Tensor], torch.Tensor]) –
- Return type
Tuple[torch.Tensor, Union[Tuple[torch.Tensor, torch.Tensor], torch.Tensor]]