pytagi.nn.embedding#

Classes#

Embedding

Embedding layer

Module Contents#

class pytagi.nn.embedding.Embedding(num_embeddings: int, embedding_dim: int, input_size: int = 0, scale: float = 1.0, padding_idx: int = -1)[source]#

Bases: pytagi.nn.base_layer.BaseLayer

Embedding layer

The embedding layer maps discrete categorical indices to continuous vector representations.

Parameters:
  • num_embeddings (int) – The size of the vocabulary (the total number of possible indices).

  • embedding_dim (int) – The dimensionality of the embedding vectors.

  • input_size (int) – The size of the input sequence. Defaults to 0.

  • scale (float) – A scaling factor applied to the embedding vectors. Defaults to 1.0.

  • padding_idx (int) – If specified, the embedding vector at this index is initialized to zeros and is not updated during training. Defaults to -1 (disabled).

Initializes the Embedding layer.

get_layer_info() str[source]#

Retrieves detailed information about the Embedding layer.

Returns:

A string containing the layer’s configuration.

Return type:

str

get_layer_name() str[source]#

Retrieves the name of the Embedding layer.

Returns:

The name of the layer.

Return type:

str

init_weight_bias()[source]#

Initializes the embedding matrix (the learnable weights of the layer).