src/transformers/models/vit_hybrid/modeling_vit_hybrid.py/ViTHybridPatchEmbeddings/forward
class ViTHybridPatchEmbeddings:    def forward(self, pixel_values: torch.Tensor, interpolate_pos_encoding: bool = False) -> torch.Tensor:
        _, num_channels, height, width = pixel_values.shape
        if num_channels != self.num_channels:
            raise ValueError(
                "Make sure that the channel dimension of the pixel values match with the one set in the configuration."
            )
        if not interpolate_pos_encoding:
            if height != self.image_size[0] or width != self.image_size[1]:
                raise ValueError(
                    f"Input image size ({height}*{width}) doesn't match model"
                    f" ({self.image_size[0]}*{self.image_size[1]})."
                )

        features = self.backbone(pixel_values).feature_maps[-1]
        embeddings = self.projection(features).flatten(2).transpose(1, 2)

        return embeddings