ConvEncoder

class ConvEncoder(num_embeddings, embedding_dim, max_seq_len, padding_idx, token_dropout, hidden_dim, kernel_size, dropout, num_conv_layers)[source]

CNN based encoder. Inputs are padded on both sides before passing through a 1D CNN, a GLU activation function, a skip connection, an optional dropout layer and a fully connected linear layer.

forward(src_tokens)[source]
src_tokenstorch LongTensor

Indices of the source sentence tokens. Size of (batch_size, padded_sent_length)