class_docstr: Construct Vivit Tubelet embeddings.
  
  This module turns a batch of videos of shape (batch_size, num_frames, num_channels, height, width) into a tensor of
  shape (batch_size, seq_len, hidden_size) to be consumed by a Transformer encoder.
  
  The seq_len (the number of patches) equals (number of frames // tubelet_size[0]) * (height // tubelet_size[1]) *
  (width // tubelet_size[2]).
class_docstr_tok: ["Construct","Vivit","Tubelet","embeddings",".","This","module","turns","a","batch","of","videos","of","shape","(","batch_size",",","num_frames",",","num_channels",",","height",",","width",")","into","a","tensor","of","shape","(","batch_size",",","seq_len",",","hidden_size",")","to","be","consumed","by","a","Transformer","encoder",".","The","seq_len","(","the","number","of","patches",")","equals","(","number","of","frames","\/\/","tubelet_size","[","0","]",")","*","(","height","\/\/","tubelet_size","[","1","]",")","*","(","width","\/\/","tubelet_size","[","2","]",")","."]
code: def forward(self, pixel_values):
      (
          batch_size,
          num_frames,
          num_channels,
          height,
          width,
      ) = pixel_values.shape
      if height != self.image_size or width != self.image_size:
          raise ValueError(
              f"Input image size ({height}*{width}) doesn't match model ({self.image_size}*{self.image_size})."
          )
  
      # permute to (batch_size, num_channels, num_frames, height, width)
      pixel_values = pixel_values.permute(0, 2, 1, 3, 4)
  
      x = self.projection(pixel_values)
      # out_batch_size, out_num_channels, out_num_frames, out_height, out_width = x.shape
      x = self.projection(pixel_values).flatten(2).transpose(1, 2)
      return x
  
imports: import math
  from typing import Optional, Set, Tuple, Union
  import torch
  import torch.utils.checkpoint
  from torch import nn
  from torch.nn import CrossEntropyLoss, MSELoss
  from ...activations import ACT2FN
  from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput
  from ...modeling_utils import PreTrainedModel
  from ...pytorch_utils import find_pruneable_heads_and_indices, prune_linear_layer
  from ...utils import add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings
  from .configuration_vivit import VivitConfig
label_desc: Use image node_id 2 for calling the VivitTubeletEmbeddings obj's underlying member method code with example usage: obj.forward(pixel_values) and returns: x