class

ML::NN::PatchEmbedding

Inherits Reference / Object

Patch Embedding: Convert image to sequence of patch embeddings Image [B, C, H, W] -> Patches [B, num_patches, embed_dim]

Constructors

new(img_size : Int32 = 224, patch_size : Int32 = 16, in_channels : Int32 = 3, embed_dim : Int32 = 768, device : Tensor::Device = Tensor.default_device)
Source

Instance methods

call(x : Autograd::Variable) : Autograd::Variable
Source
embed_dim
Source
forward(x : Autograd::Variable) : Autograd::Variable

Forward: [B, C, H, W] -> [B, num_patches, embed_dim]

Source
in_channels
Source
num_patches
Source
parameters
Source
patch_size
Source
proj

Linear projection of flattened patches

Source