docstr: labels (`torch.LongTensor` of shape `(batch_size, height, width)`, *optional*):
      Ground truth image matting for computing the loss.
  
  Returns:
  
  Examples:
  
  ```python
  >>> from transformers import VitMatteImageProcessor, VitMatteForImageMatting
  >>> import torch
  >>> from PIL import Image
  >>> from huggingface_hub import hf_hub_download
  
  >>> processor = VitMatteImageProcessor.from_pretrained("hustvl/vitmatte-small-composition-1k")
  >>> model = VitMatteForImageMatting.from_pretrained("hustvl/vitmatte-small-composition-1k")
  
  >>> filepath = hf_hub_download(
  ...     repo_id="hf-internal-testing/image-matting-fixtures", filename="image.png", repo_type="dataset"
  ... )
  >>> image = Image.open(filepath).convert("RGB")
  >>> filepath = hf_hub_download(
  ...     repo_id="hf-internal-testing/image-matting-fixtures", filename="trimap.png", repo_type="dataset"
  ... )
  >>> trimap = Image.open(filepath).convert("L")
  
  >>> # prepare image + trimap for the model
  >>> inputs = processor(images=image, trimaps=trimap, return_tensors="pt")
  
  >>> with torch.no_grad():
  ...     alphas = model(**inputs).alphas
  >>> print(alphas.shape)
  torch.Size([1, 1, 640, 960])
  ```
docstr_tok: ["labels","(","`","torch.LongTensor","`","of","shape","`","(","batch_size",",","height",",","width",")","`",",","*","optional","*",")",":","Ground","truth","image","matting","for","computing","the","loss",".","Returns",":","Examples",":","``","`","python",">",">",">","from","transformers","import","VitMatteImageProcessor",",","VitMatteForImageMatting",">",">",">","import","torch",">",">",">","from","PIL","import","Image",">",">",">","from","huggingface_hub","import","hf_hub_download",">",">",">","processor","=","VitMatteImageProcessor.from_pretrained","(","``","hustvl\/vitmatte-small-composition-1k","''",")",">",">",">","model","=","VitMatteForImageMatting.from_pretrained","(","``","hustvl\/vitmatte-small-composition-1k","''",")",">",">",">","filepath","=","hf_hub_download","(","...","repo_id=","''","hf-internal-testing\/image-matting-fixtures","''",",","filename=","''","image.png","''",",","repo_type=","''","dataset","''","...",")",">",">",">","image","=","Image.open","(","filepath",")",".convert","(","``","RGB","''",")",">",">",">","filepath","=","hf_hub_download","(","...","repo_id=","''","hf-internal-testing\/image-matting-fixtures","''",",","filename=","''","trimap.png","''",",","repo_type=","''","dataset","''","...",")",">",">",">","trimap","=","Image.open","(","filepath",")",".convert","(","``","L","''",")",">",">",">","#","prepare","image","+","trimap","for","the","model",">",">",">","inputs","=","processor","(","images=image",",","trimaps=trimap",",","return_tensors=","''","pt","''",")",">",">",">","with","torch.no_grad","(",")",":","...","alphas","=","model","(","*","*","inputs",")",".alphas",">",">",">","print","(","alphas.shape",")","torch.Size","(","[","1",",","1",",","640",",","960","]",")","``","`"]
code: def forward(
      self,
      pixel_values: Optional[torch.Tensor] = None,
      output_attentions: Optional[bool] = None,
      output_hidden_states: Optional[bool] = None,
      labels: Optional[torch.Tensor] = None,
      return_dict: Optional[bool] = None,
  ):
      """
      labels (`torch.LongTensor` of shape `(batch_size, height, width)`, *optional*):
          Ground truth image matting for computing the loss.
  
      Returns:
  
      Examples:
  
      ```python
      >>> from transformers import VitMatteImageProcessor, VitMatteForImageMatting
      >>> import torch
      >>> from PIL import Image
      >>> from huggingface_hub import hf_hub_download
  
      >>> processor = VitMatteImageProcessor.from_pretrained("hustvl/vitmatte-small-composition-1k")
      >>> model = VitMatteForImageMatting.from_pretrained("hustvl/vitmatte-small-composition-1k")
  
      >>> filepath = hf_hub_download(
      ...     repo_id="hf-internal-testing/image-matting-fixtures", filename="image.png", repo_type="dataset"
      ... )
      >>> image = Image.open(filepath).convert("RGB")
      >>> filepath = hf_hub_download(
      ...     repo_id="hf-internal-testing/image-matting-fixtures", filename="trimap.png", repo_type="dataset"
      ... )
      >>> trimap = Image.open(filepath).convert("L")
  
      >>> # prepare image + trimap for the model
      >>> inputs = processor(images=image, trimaps=trimap, return_tensors="pt")
  
      >>> with torch.no_grad():
      ...     alphas = model(**inputs).alphas
      >>> print(alphas.shape)
      torch.Size([1, 1, 640, 960])
      ```"""
      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
      )
  
      outputs = self.backbone.forward_with_filtered_kwargs(
          pixel_values,
          output_hidden_states=output_hidden_states,
          output_attentions=output_attentions,
      )
  
      features = outputs.feature_maps[-1]
      alphas = self.decoder(features, pixel_values)
  
      loss = None
      if labels is not None:
          raise NotImplementedError("Training is not yet supported")
  
      if not return_dict:
          output = (alphas,) + outputs[1:]
          return ((loss,) + output) if loss is not None else output
  
      return ImageMattingOutput(
          loss=loss,
          alphas=alphas,
          hidden_states=outputs.hidden_states,
          attentions=outputs.attentions,
      )
  
imports: from dataclasses import dataclass
  from typing import Optional, Tuple
  import torch
  from torch import nn
  from ...None import AutoBackbone
  from ...modeling_utils import PreTrainedModel
  from ...utils import ModelOutput, add_start_docstrings, add_start_docstrings_to_model_forward, replace_return_docstrings
  from .configuration_vitmatte import VitMatteConfig
label_desc: Use image node_id 2 for calling the VitMatteForImageMatting obj's underlying member method code with example usage: obj.forward(pixel_values, output_attentions, output_hidden_states, labels, return_dict) and returns: ImageMattingOutput, unknown