class_docstr: Vision Transformer as per https://arxiv.org/abs/2010.11929.
class_docstr_tok: ["Vision","Transformer","as","per","https",":","\/\/arxiv.org\/abs\/2010.11929","."]
code: def _process_input(self, x: torch.Tensor) -> torch.Tensor:
      n, c, h, w = x.shape
      p = self.patch_size
      torch._assert(
          h == self.image_size,
          f"Wrong image height! Expected {self.image_size} but got {h}!",
      )
      torch._assert(
          w == self.image_size,
          f"Wrong image width! Expected {self.image_size} but got {w}!",
      )
      n_h = h // p
      n_w = w // p
  
      # (n, c, h, w) -> (n, hidden_dim, n_h, n_w)
      x = self.conv_proj(x)
      # (n, hidden_dim, n_h, n_w) -> (n, hidden_dim, (n_h * n_w))
      x = x.reshape(n, self.hidden_dim, n_h * n_w)
  
      # (n, hidden_dim, (n_h * n_w)) -> (n, (n_h * n_w), hidden_dim)
      # The self attention layer expects inputs in the format (N, S, E)
      # where S is the source sequence length, N is the batch size, E is the
      # embedding dimension
      x = x.permute(0, 2, 1)
  
      return x
  
imports: import math
  from collections import OrderedDict
  from functools import partial
  from typing import Any, Callable, Dict, List, NamedTuple, Optional
  import torch
  import torch.nn
  from ..ops.misc import Conv2dNormActivation, MLP
  from ..transforms._presets import ImageClassification, InterpolationMode
  from ..utils import _log_api_usage_once
  from ._api import register_model, Weights, WeightsEnum
  from ._meta import _IMAGENET_CATEGORIES
  from ._utils import _ovewrite_named_param, handle_legacy_interface
label_desc: Use image node_id 2 for calling the VisionTransformer obj's underlying member method code with example usage: obj._process_input(x) and returns: x