Linear Embedding

class vformer.encoder.embedding.linear.LinearEmbedding(embedding_dim, patch_height, patch_width, patch_dim)[source]

Projects image patches into embedding space using Linear layer.

Parameters
  • embedding_dim (int) – Dimension of the resultant embedding

  • patch_height (int) – Height of the patch

  • patch_width (int) – Width of the patch

  • patch_dim (int) – Dimension of the patch

forward(x)[source]
Parameters

x (torch.Tensor) – Input tensor

Returns

Returns patch embeddings of size embedding_dim

Return type

torch.Tensor