RandomLSTM

class lightautoml.text.dl_transformers.RandomLSTM(embed_size=300, hidden_size=256, pooling='mean', num_layers=1, **kwargs)[source]

Bases: torch.nn.Module

Class to compute Random LSTM sentence embeddings from words embeddings.

__init__(embed_size=300, hidden_size=256, pooling='mean', num_layers=1, **kwargs)[source]

Random LSTM sentence embeddings.

Parameters
  • embed_size (int) – Size of word embeddings.

  • hidden_size (int) – Size of hidden dimensions of LSTM.

  • pooling (str) – Pooling type.

  • num_layers (int) – Number of lstm layers.

  • **kwargs – Ignored params.

Note

There are several pooling types:

  • ‘max’: Maximum on seq_len dimension for non masked inputs.

  • ‘mean’: Mean on seq_len dimension for non masked inputs.

  • ‘sum’: Sum on seq_len dimension for non masked inputs.

get_out_shape()[source]

Output shape.

Return type

int

Returns

Int with module output shape.

get_name()[source]

Module name.

Return type

str

Returns

String with module name.