kiwi.modules.common.positional_encoding

Module Contents

Classes

PositionalEncoding

Absolute positional encoding mechanism.

class kiwi.modules.common.positional_encoding.PositionalEncoding(max_seq_len: int, hidden_size: int)

Bases: torch.nn.Module

Absolute positional encoding mechanism.

Parameters
  • max_seq_len – hypothetical maximum sequence length (usually 1000).

  • hidden_size – embeddings size.

forward(self, emb)
kiwi.modules.common.positional_encoding.batch_size = 8