spd_learn.modules.PatchEmbeddingLayer#
- class spd_learn.modules.PatchEmbeddingLayer(n_chans: int, n_patches: int, stride: int | None = None, device: device | None = None, dtype: dtype | None = None)[source]#
Bases:
ModulePatch Embedding Layer.
This layer extracts patches from an input signal using an unfolding operation, which is similar to a convolution.
- Parameters:
- forward(x: Tensor) Tensor[source]#
Forward pass of the PatchEmbeddingLayer.
- Parameters:
x (torch.Tensor) – Input tensor of shape (batch, channels, time).
- Returns:
A tensor of patches with shape (batch, n_patches, channels, patch_size).
- Return type: