mmlearn.datasets.processors.tokenizers.Img2Seq¶
- class Img2Seq(img_size, patch_size, n_channels, d_model)[source]¶
Bases:
Module
Convert a batch of images to a batch of sequences.
- Parameters:
Methods
Attributes
- __call__(batch)[source]¶
Convert a batch of images to a batch of sequences.
- Parameters:
batch (torch.Tensor) – Batch of images of shape
(b, h, w, c)
whereb
is the batch size,h
is the height,w
is the width, andc
is the number of channels.- Returns:
Batch of sequences of shape
(b, s, d)
whereb
is the batch size,s
is the sequence length, andd
is the dimension of the output sequence.- Return type: