Sequence1dBlock#
- class deeplay.blocks.sequence.sequence1d.Sequence1dBlock(*args, **kwargs)#
Bases:
BaseBlockConvolutional block with optional normalization and activation.
Attributes Summary
Methods Summary
GRU()LSTM()RNN()append_dropout(p[, name])Append a dropout layer to the block.
forward(x)Define the computation performed at every call.
Returns the default normalization function for the block.
insert_dropout(p, after[, name])Insert a dropout layer to the block.
prepend_dropout(p[, name])Prepend a dropout layer to the block.
Attributes Documentation
- is_recurrent#
Methods Documentation
- GRU()#
- LSTM()#
- RNN()#
- append_dropout(p: float, name: str | None = 'dropout')#
Append a dropout layer to the block.
Parameters#
- pfloat
The dropout probability.
- nameOptional[str], optional
The name of the dropout layer, by default “dropout”.
- bidirectional()#
- forward(x)#
Define 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- get_default_normalization() DeeplayModule#
Returns the default normalization function for the block.
- insert_dropout(p: float, after: str, name: str | None = 'dropout')#
Insert a dropout layer to the block.
Parameters#
- pfloat
The dropout probability.
- afterstr
The name of the layer after which the dropout layer will be executed.
- nameOptional[str], optional
The name of the dropout layer, by default “dropout”.
Raises#
- ValueError
If the layer after is not found in the block.
- prepend_dropout(p: float, name: str | None = 'dropout')#
Prepend a dropout layer to the block.
Parameters#
- pfloat
The dropout probability.
- nameOptional[str], optional
The name of the dropout layer, by default “dropout”.
- run_with_dummy_data()#