docstr: Returns:
  
  Examples:
  
  ```python
  >>> from transformers import VitDetConfig, VitDetBackbone
  >>> import torch
  
  >>> config = VitDetConfig()
  >>> model = VitDetBackbone(config)
  
  >>> pixel_values = torch.randn(1, 3, 224, 224)
  
  >>> with torch.no_grad():
  ...     outputs = model(pixel_values)
  
  >>> feature_maps = outputs.feature_maps
  >>> list(feature_maps[-1].shape)
  [1, 768, 14, 14]
  ```
docstr_tok: ["Returns",":","Examples",":","``","`","python",">",">",">","from","transformers","import","VitDetConfig",",","VitDetBackbone",">",">",">","import","torch",">",">",">","config","=","VitDetConfig","(",")",">",">",">","model","=","VitDetBackbone","(","config",")",">",">",">","pixel_values","=","torch.randn","(","1",",","3",",","224",",","224",")",">",">",">","with","torch.no_grad","(",")",":","...","outputs","=","model","(","pixel_values",")",">",">",">","feature_maps","=","outputs.feature_maps",">",">",">","list","(","feature_maps","[","-1","]",".shape",")","[","1",",","768",",","14",",","14","]","``","`"]
code: def forward(
      self,
      pixel_values: torch.Tensor,
      output_hidden_states: Optional[bool] = None,
      output_attentions: Optional[bool] = None,
      return_dict: Optional[bool] = None,
  ) -> BackboneOutput:
      """
      Returns:
  
      Examples:
  
      ```python
      >>> from transformers import VitDetConfig, VitDetBackbone
      >>> import torch
  
      >>> config = VitDetConfig()
      >>> model = VitDetBackbone(config)
  
      >>> pixel_values = torch.randn(1, 3, 224, 224)
  
      >>> with torch.no_grad():
      ...     outputs = model(pixel_values)
  
      >>> feature_maps = outputs.feature_maps
      >>> list(feature_maps[-1].shape)
      [1, 768, 14, 14]
      ```"""
      return_dict = (
          return_dict
          if return_dict is not None
          else self.config.use_return_dict
      )
      output_hidden_states = (
          output_hidden_states
          if output_hidden_states is not None
          else self.config.output_hidden_states
      )
      output_attentions = (
          output_attentions
          if output_attentions is not None
          else self.config.output_attentions
      )
  
      embedding_output = self.embeddings(pixel_values)
  
      outputs = self.encoder(
          embedding_output,
          output_hidden_states=True,
          output_attentions=output_attentions,
          return_dict=return_dict,
      )
  
      hidden_states = (
          outputs.hidden_states if return_dict else outputs[1]
      )
  
      feature_maps = ()
      for stage, hidden_state in zip(self.stage_names, hidden_states):
          if stage in self.out_features:
              feature_maps += (hidden_state,)
  
      if not return_dict:
          if output_hidden_states:
              output = (feature_maps,) + outputs[1:]
          else:
              output = (feature_maps,) + outputs[2:]
          return output
  
      return BackboneOutput(
          feature_maps=feature_maps,
          hidden_states=outputs.hidden_states
          if output_hidden_states
          else None,
          attentions=outputs.attentions,
      )
  
imports: import collections.abc
  import math
  from typing import Dict, List, Optional, Tuple, Union
  import torch
  import torch.utils.checkpoint
  from torch import nn
  from ...activations import ACT2FN
  from ...modeling_outputs import BackboneOutput, BaseModelOutput
  from ...modeling_utils import PreTrainedModel
  from ...utils import add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings
  from ...utils.backbone_utils import BackboneMixin
  from .configuration_vitdet import VitDetConfig
label_desc: Use image node_id 3 for calling the VitDetBackbone obj's underlying member method code with example usage: obj.forward(pixel_values, output_hidden_states, output_attentions, return_dict) and returns: BackboneOutput, output