# 模型输出

所有模型的输出都是 [ModelOutput](/docs/transformers/v4.57.0/zh/main_classes/output#transformers.utils.ModelOutput) 的子类的实例。这些是包含模型返回的所有信息的数据结构，但也可以用作元组或字典。

让我们看一个例子：

```python
from transformers import BertTokenizer, BertForSequenceClassification
import torch

tokenizer = BertTokenizer.from_pretrained("google-bert/bert-base-uncased")
model = BertForSequenceClassification.from_pretrained("google-bert/bert-base-uncased")

inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
labels = torch.tensor([1]).unsqueeze(0)  # Batch size 1
outputs = model(**inputs, labels=labels)
```

`outputs` 对象是 [SequenceClassifierOutput](/docs/transformers/v4.57.0/zh/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput)，如下面该类的文档中所示，它表示它有一个可选的 `loss`，一个 `logits`，一个可选的 `hidden_states` 和一个可选的 `attentions` 属性。在这里，我们有 `loss`，因为我们传递了 `labels`，但我们没有 `hidden_states` 和 `attentions`，因为我们没有传递 `output_hidden_states=True` 或 `output_attentions=True`。

<Tip>

当传递 `output_hidden_states=True` 时，您可能希望 `outputs.hidden_states[-1]` 与 `outputs.last_hidden_states` 完全匹配。然而，这并不总是成立。一些模型在返回最后的 hidden state时对其应用归一化或其他后续处理。

</Tip>


您可以像往常一样访问每个属性，如果模型未返回该属性，您将得到 `None`。在这里，例如，`outputs.loss` 是模型计算的损失，而 `outputs.attentions` 是 `None`。

当将我们的 `outputs` 对象视为元组时，它仅考虑那些没有 `None` 值的属性。例如这里它有两个元素，`loss` 和 `logits`，所以

```python
outputs[:2]
```

将返回元组 `(outputs.loss, outputs.logits)`。

将我们的 `outputs` 对象视为字典时，它仅考虑那些没有 `None` 值的属性。例如在这里它有两个键，分别是 `loss` 和 `logits`。

我们在这里记录了被多个类型模型使用的通用模型输出。特定输出类型在其相应的模型页面上有文档。

## ModelOutput[[transformers.utils.ModelOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.utils.ModelOutput</name><anchor>transformers.utils.ModelOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/utils/generic.py#L308</source><parameters>[{"name": "*args", "val": ""}, {"name": "**kwargs", "val": ""}]</parameters></docstring>

Base class for all model outputs as dataclass. Has a `__getitem__` that allows indexing by integer or slice (like a
tuple) or strings (like a dictionary) that will ignore the `None` attributes. Otherwise behaves like a regular
python dictionary.

<Tip warning={true}>

You can't unpack a `ModelOutput` directly. Use the [to_tuple()](/docs/transformers/v4.57.0/zh/main_classes/output#transformers.utils.ModelOutput.to_tuple) method to convert it to a tuple
before.

</Tip>



<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>to_tuple</name><anchor>transformers.utils.ModelOutput.to_tuple</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/utils/generic.py#L445</source><parameters>[]</parameters></docstring>

Convert self to a tuple containing all the attributes/keys that are not `None`.


</div></div>

## BaseModelOutput[[transformers.modeling_outputs.BaseModelOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_outputs.BaseModelOutput</name><anchor>transformers.modeling_outputs.BaseModelOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_outputs.py#L26</source><parameters>[{"name": "last_hidden_state", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "hidden_states", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}]</parameters><paramsdesc>- **last_hidden_state** (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`) --
  Sequence of hidden-states at the output of the last layer of the model.
- **hidden_states** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, +
  one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.
- **attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for model's outputs, with potential hidden states and attentions.




</div>

## BaseModelOutputWithPooling[[transformers.modeling_outputs.BaseModelOutputWithPooling]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_outputs.BaseModelOutputWithPooling</name><anchor>transformers.modeling_outputs.BaseModelOutputWithPooling</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_outputs.py#L71</source><parameters>[{"name": "last_hidden_state", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "pooler_output", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "hidden_states", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}]</parameters><paramsdesc>- **last_hidden_state** (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`) --
  Sequence of hidden-states at the output of the last layer of the model.
- **pooler_output** (`torch.FloatTensor` of shape `(batch_size, hidden_size)`) --
  Last layer hidden-state of the first token of the sequence (classification token) after further processing
  through the layers used for the auxiliary pretraining task. E.g. for BERT-family of models, this returns
  the classification token after processing through a linear layer and a tanh activation function. The linear
  layer weights are trained from the next sentence prediction (classification) objective during pretraining.
- **hidden_states** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, +
  one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.
- **attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for model's outputs that also contains a pooling of the last hidden states.




</div>

## BaseModelOutputWithCrossAttentions[[transformers.modeling_outputs.BaseModelOutputWithCrossAttentions]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_outputs.BaseModelOutputWithCrossAttentions</name><anchor>transformers.modeling_outputs.BaseModelOutputWithCrossAttentions</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_outputs.py#L161</source><parameters>[{"name": "last_hidden_state", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "hidden_states", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "cross_attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}]</parameters><paramsdesc>- **last_hidden_state** (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`) --
  Sequence of hidden-states at the output of the last layer of the model.
- **hidden_states** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, +
  one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.
- **attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.
- **cross_attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` and `config.add_cross_attention=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the
  weighted average in the cross-attention heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for model's outputs, with potential hidden states and attentions.




</div>

## BaseModelOutputWithPoolingAndCrossAttentions[[transformers.modeling_outputs.BaseModelOutputWithPoolingAndCrossAttentions]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_outputs.BaseModelOutputWithPoolingAndCrossAttentions</name><anchor>transformers.modeling_outputs.BaseModelOutputWithPoolingAndCrossAttentions</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_outputs.py#L194</source><parameters>[{"name": "last_hidden_state", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "pooler_output", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "hidden_states", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "past_key_values", "val": ": typing.Optional[transformers.cache_utils.Cache] = None"}, {"name": "attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "cross_attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}]</parameters><paramsdesc>- **last_hidden_state** (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`) --
  Sequence of hidden-states at the output of the last layer of the model.
- **pooler_output** (`torch.FloatTensor` of shape `(batch_size, hidden_size)`) --
  Last layer hidden-state of the first token of the sequence (classification token) after further processing
  through the layers used for the auxiliary pretraining task. E.g. for BERT-family of models, this returns
  the classification token after processing through a linear layer and a tanh activation function. The linear
  layer weights are trained from the next sentence prediction (classification) objective during pretraining.
- **hidden_states** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, +
  one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.
- **attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.
- **cross_attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` and `config.add_cross_attention=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the
  weighted average in the cross-attention heads.
- **past_key_values** (`Cache`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`) --
  It is a `Cache` instance. For more details, see our [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache).

  Contains pre-computed hidden-states (key and values in the self-attention blocks and optionally if
  `config.is_encoder_decoder=True` in the cross-attention blocks) that can be used (see `past_key_values`
  input) to speed up sequential decoding.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for model's outputs that also contains a pooling of the last hidden states.




</div>

## BaseModelOutputWithPast[[transformers.modeling_outputs.BaseModelOutputWithPast]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_outputs.BaseModelOutputWithPast</name><anchor>transformers.modeling_outputs.BaseModelOutputWithPast</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_outputs.py#L125</source><parameters>[{"name": "last_hidden_state", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "past_key_values", "val": ": typing.Optional[transformers.cache_utils.Cache] = None"}, {"name": "hidden_states", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}]</parameters><paramsdesc>- **last_hidden_state** (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`) --
  Sequence of hidden-states at the output of the last layer of the model.

  If `past_key_values` is used only the last hidden-state of the sequences of shape `(batch_size, 1,
  hidden_size)` is output.
- **past_key_values** (`Cache`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`) --
  It is a `Cache` instance. For more details, see our [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache).

  Contains pre-computed hidden-states (key and values in the self-attention blocks and optionally if
  `config.is_encoder_decoder=True` in the cross-attention blocks) that can be used (see `past_key_values`
  input) to speed up sequential decoding.
- **hidden_states** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, +
  one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.
- **attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for model's outputs that may also contain a past key/values (to speed up sequential decoding).




</div>

## BaseModelOutputWithPastAndCrossAttentions[[transformers.modeling_outputs.BaseModelOutputWithPastAndCrossAttentions]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_outputs.BaseModelOutputWithPastAndCrossAttentions</name><anchor>transformers.modeling_outputs.BaseModelOutputWithPastAndCrossAttentions</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_outputs.py#L240</source><parameters>[{"name": "last_hidden_state", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "past_key_values", "val": ": typing.Optional[transformers.cache_utils.Cache] = None"}, {"name": "hidden_states", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "cross_attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}]</parameters><paramsdesc>- **last_hidden_state** (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`) --
  Sequence of hidden-states at the output of the last layer of the model.

  If `past_key_values` is used only the last hidden-state of the sequences of shape `(batch_size, 1,
  hidden_size)` is output.
- **past_key_values** (`Cache`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`) --
  It is a `Cache` instance. For more details, see our [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache).

  Contains pre-computed hidden-states (key and values in the self-attention blocks and optionally if
  `config.is_encoder_decoder=True` in the cross-attention blocks) that can be used (see `past_key_values`
  input) to speed up sequential decoding.
- **hidden_states** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, +
  one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.
- **attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.
- **cross_attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` and `config.add_cross_attention=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the
  weighted average in the cross-attention heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for model's outputs that may also contain a past key/values (to speed up sequential decoding).




</div>

## Seq2SeqModelOutput[[transformers.modeling_outputs.Seq2SeqModelOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_outputs.Seq2SeqModelOutput</name><anchor>transformers.modeling_outputs.Seq2SeqModelOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_outputs.py#L500</source><parameters>[{"name": "last_hidden_state", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "past_key_values", "val": ": typing.Optional[transformers.cache_utils.EncoderDecoderCache] = None"}, {"name": "decoder_hidden_states", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "decoder_attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "cross_attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "encoder_last_hidden_state", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "encoder_hidden_states", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "encoder_attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}]</parameters><paramsdesc>- **last_hidden_state** (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`) --
  Sequence of hidden-states at the output of the last layer of the decoder of the model.

  If `past_key_values` is used only the last hidden-state of the sequences of shape `(batch_size, 1,
  hidden_size)` is output.
- **past_key_values** (`EncoderDecoderCache`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`) --
  It is a `EncoderDecoderCache` instance. For more details, see our [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache).

  Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
  blocks) that can be used (see `past_key_values` input) to speed up sequential decoding.
- **decoder_hidden_states** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, +
  one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the decoder at the output of each layer plus the optional initial embedding outputs.
- **decoder_attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the decoder, after the attention softmax, used to compute the weighted average in the
  self-attention heads.
- **cross_attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the
  weighted average in the cross-attention heads.
- **encoder_last_hidden_state** (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*) --
  Sequence of hidden-states at the output of the last layer of the encoder of the model.
- **encoder_hidden_states** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, +
  one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the encoder at the output of each layer plus the optional initial embedding outputs.
- **encoder_attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the encoder, after the attention softmax, used to compute the weighted average in the
  self-attention heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for model encoder's outputs that also contains : pre-computed hidden states that can speed up sequential
decoding.




</div>

## CausalLMOutput[[transformers.modeling_outputs.CausalLMOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_outputs.CausalLMOutput</name><anchor>transformers.modeling_outputs.CausalLMOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_outputs.py#L629</source><parameters>[{"name": "loss", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "logits", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "hidden_states", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}]</parameters><paramsdesc>- **loss** (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided) --
  Language modeling loss (for next-token prediction).
- **logits** (`torch.FloatTensor` of shape `(batch_size, sequence_length, config.vocab_size)`) --
  Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).
- **hidden_states** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, +
  one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.
- **attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for causal language model (or autoregressive) outputs.




</div>

## CausalLMOutputWithCrossAttentions[[transformers.modeling_outputs.CausalLMOutputWithCrossAttentions]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_outputs.CausalLMOutputWithCrossAttentions</name><anchor>transformers.modeling_outputs.CausalLMOutputWithCrossAttentions</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_outputs.py#L693</source><parameters>[{"name": "loss", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "logits", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "past_key_values", "val": ": typing.Optional[transformers.cache_utils.Cache] = None"}, {"name": "hidden_states", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "cross_attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}]</parameters><paramsdesc>- **loss** (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided) --
  Language modeling loss (for next-token prediction).
- **logits** (`torch.FloatTensor` of shape `(batch_size, sequence_length, config.vocab_size)`) --
  Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).
- **hidden_states** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, +
  one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.
- **attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.
- **cross_attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Cross attentions weights after the attention softmax, used to compute the weighted average in the
  cross-attention heads.
- **past_key_values** (`Cache`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`) --
  It is a `Cache` instance. For more details, see our [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache).

  Contains pre-computed hidden-states (key and values in the attention blocks) that can be used (see
  `past_key_values` input) to speed up sequential decoding.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for causal language model (or autoregressive) outputs.




</div>

## CausalLMOutputWithPast[[transformers.modeling_outputs.CausalLMOutputWithPast]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_outputs.CausalLMOutputWithPast</name><anchor>transformers.modeling_outputs.CausalLMOutputWithPast</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_outputs.py#L658</source><parameters>[{"name": "loss", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "logits", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "past_key_values", "val": ": typing.Optional[transformers.cache_utils.Cache] = None"}, {"name": "hidden_states", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}]</parameters><paramsdesc>- **loss** (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided) --
  Language modeling loss (for next-token prediction).
- **logits** (`torch.FloatTensor` of shape `(batch_size, sequence_length, config.vocab_size)`) --
  Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).
- **past_key_values** (`Cache`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`) --
  It is a `Cache` instance. For more details, see our [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache).

  Contains pre-computed hidden-states (key and values in the self-attention blocks) that can be used (see
  `past_key_values` input) to speed up sequential decoding.
- **hidden_states** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, +
  one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.
- **attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for causal language model (or autoregressive) outputs.




</div>

## MaskedLMOutput[[transformers.modeling_outputs.MaskedLMOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_outputs.MaskedLMOutput</name><anchor>transformers.modeling_outputs.MaskedLMOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_outputs.py#L770</source><parameters>[{"name": "loss", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "logits", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "hidden_states", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}]</parameters><paramsdesc>- **loss** (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided) --
  Masked language modeling (MLM) loss.
- **logits** (`torch.FloatTensor` of shape `(batch_size, sequence_length, config.vocab_size)`) --
  Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).
- **hidden_states** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, +
  one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.
- **attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for masked language models outputs.




</div>

## Seq2SeqLMOutput[[transformers.modeling_outputs.Seq2SeqLMOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_outputs.Seq2SeqLMOutput</name><anchor>transformers.modeling_outputs.Seq2SeqLMOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_outputs.py#L799</source><parameters>[{"name": "loss", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "logits", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "past_key_values", "val": ": typing.Optional[transformers.cache_utils.EncoderDecoderCache] = None"}, {"name": "decoder_hidden_states", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "decoder_attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "cross_attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "encoder_last_hidden_state", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "encoder_hidden_states", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "encoder_attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}]</parameters><paramsdesc>- **loss** (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided) --
  Language modeling loss.
- **logits** (`torch.FloatTensor` of shape `(batch_size, sequence_length, config.vocab_size)`) --
  Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).
- **past_key_values** (`EncoderDecoderCache`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`) --
  It is a `EncoderDecoderCache` instance. For more details, see our [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache).

  Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
  blocks) that can be used (see `past_key_values` input) to speed up sequential decoding.
- **decoder_hidden_states** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, +
  one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the decoder at the output of each layer plus the initial embedding outputs.
- **decoder_attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the decoder, after the attention softmax, used to compute the weighted average in the
  self-attention heads.
- **cross_attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the
  weighted average in the cross-attention heads.
- **encoder_last_hidden_state** (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*) --
  Sequence of hidden-states at the output of the last layer of the encoder of the model.
- **encoder_hidden_states** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, +
  one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the encoder at the output of each layer plus the initial embedding outputs.
- **encoder_attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the encoder, after the attention softmax, used to compute the weighted average in the
  self-attention heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for sequence-to-sequence language models outputs.




</div>

## NextSentencePredictorOutput[[transformers.modeling_outputs.NextSentencePredictorOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_outputs.NextSentencePredictorOutput</name><anchor>transformers.modeling_outputs.NextSentencePredictorOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_outputs.py#L930</source><parameters>[{"name": "loss", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "logits", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "hidden_states", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}]</parameters><paramsdesc>- **loss** (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `next_sentence_label` is provided) --
  Next sequence prediction (classification) loss.
- **logits** (`torch.FloatTensor` of shape `(batch_size, 2)`) --
  Prediction scores of the next sequence prediction (classification) head (scores of True/False continuation
  before SoftMax).
- **hidden_states** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, +
  one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.
- **attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for outputs of models predicting if two sentences are consecutive or not.




</div>

## SequenceClassifierOutput[[transformers.modeling_outputs.SequenceClassifierOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_outputs.SequenceClassifierOutput</name><anchor>transformers.modeling_outputs.SequenceClassifierOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_outputs.py#L960</source><parameters>[{"name": "loss", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "logits", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "hidden_states", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}]</parameters><paramsdesc>- **loss** (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided) --
  Classification (or regression if config.num_labels==1) loss.
- **logits** (`torch.FloatTensor` of shape `(batch_size, config.num_labels)`) --
  Classification (or regression if config.num_labels==1) scores (before SoftMax).
- **hidden_states** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, +
  one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.
- **attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for outputs of sentence classification models.




</div>

## Seq2SeqSequenceClassifierOutput[[transformers.modeling_outputs.Seq2SeqSequenceClassifierOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_outputs.Seq2SeqSequenceClassifierOutput</name><anchor>transformers.modeling_outputs.Seq2SeqSequenceClassifierOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_outputs.py#L989</source><parameters>[{"name": "loss", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "logits", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "past_key_values", "val": ": typing.Optional[transformers.cache_utils.EncoderDecoderCache] = None"}, {"name": "decoder_hidden_states", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "decoder_attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "cross_attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "encoder_last_hidden_state", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "encoder_hidden_states", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "encoder_attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}]</parameters><paramsdesc>- **loss** (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `label` is provided) --
  Classification (or regression if config.num_labels==1) loss.
- **logits** (`torch.FloatTensor` of shape `(batch_size, config.num_labels)`) --
  Classification (or regression if config.num_labels==1) scores (before SoftMax).
- **past_key_values** (`EncoderDecoderCache`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`) --
  It is a `EncoderDecoderCache` instance. For more details, see our [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache).

  Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
  blocks) that can be used (see `past_key_values` input) to speed up sequential decoding.
- **decoder_hidden_states** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, +
  one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the decoder at the output of each layer plus the initial embedding outputs.
- **decoder_attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the decoder, after the attention softmax, used to compute the weighted average in the
  self-attention heads.
- **cross_attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the
  weighted average in the cross-attention heads.
- **encoder_last_hidden_state** (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*) --
  Sequence of hidden-states at the output of the last layer of the encoder of the model.
- **encoder_hidden_states** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, +
  one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the encoder at the output of each layer plus the initial embedding outputs.
- **encoder_attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the encoder, after the attention softmax, used to compute the weighted average in the
  self-attention heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for outputs of sequence-to-sequence sentence classification models.




</div>

## MultipleChoiceModelOutput[[transformers.modeling_outputs.MultipleChoiceModelOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_outputs.MultipleChoiceModelOutput</name><anchor>transformers.modeling_outputs.MultipleChoiceModelOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_outputs.py#L1047</source><parameters>[{"name": "loss", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "logits", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "hidden_states", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}]</parameters><paramsdesc>- **loss** (`torch.FloatTensor` of shape *(1,)*, *optional*, returned when `labels` is provided) --
  Classification loss.
- **logits** (`torch.FloatTensor` of shape `(batch_size, num_choices)`) --
  *num_choices* is the second dimension of the input tensors. (see *input_ids* above).

  Classification scores (before SoftMax).
- **hidden_states** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, +
  one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.
- **attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for outputs of multiple choice models.




</div>

## TokenClassifierOutput[[transformers.modeling_outputs.TokenClassifierOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_outputs.TokenClassifierOutput</name><anchor>transformers.modeling_outputs.TokenClassifierOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_outputs.py#L1078</source><parameters>[{"name": "loss", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "logits", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "hidden_states", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}]</parameters><paramsdesc>- **loss** (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided)  --
  Classification loss.
- **logits** (`torch.FloatTensor` of shape `(batch_size, sequence_length, config.num_labels)`) --
  Classification scores (before SoftMax).
- **hidden_states** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, +
  one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.
- **attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for outputs of token classification models.




</div>

## QuestionAnsweringModelOutput[[transformers.modeling_outputs.QuestionAnsweringModelOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_outputs.QuestionAnsweringModelOutput</name><anchor>transformers.modeling_outputs.QuestionAnsweringModelOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_outputs.py#L1107</source><parameters>[{"name": "loss", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "start_logits", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "end_logits", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "hidden_states", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}]</parameters><paramsdesc>- **loss** (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided) --
  Total span extraction loss is the sum of a Cross-Entropy for the start and end positions.
- **start_logits** (`torch.FloatTensor` of shape `(batch_size, sequence_length)`) --
  Span-start scores (before SoftMax).
- **end_logits** (`torch.FloatTensor` of shape `(batch_size, sequence_length)`) --
  Span-end scores (before SoftMax).
- **hidden_states** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, +
  one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.
- **attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for outputs of question answering models.




</div>

## Seq2SeqQuestionAnsweringModelOutput[[transformers.modeling_outputs.Seq2SeqQuestionAnsweringModelOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_outputs.Seq2SeqQuestionAnsweringModelOutput</name><anchor>transformers.modeling_outputs.Seq2SeqQuestionAnsweringModelOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_outputs.py#L1139</source><parameters>[{"name": "loss", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "start_logits", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "end_logits", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "past_key_values", "val": ": typing.Optional[transformers.cache_utils.EncoderDecoderCache] = None"}, {"name": "decoder_hidden_states", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "decoder_attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "cross_attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "encoder_last_hidden_state", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "encoder_hidden_states", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "encoder_attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}]</parameters><paramsdesc>- **loss** (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided) --
  Total span extraction loss is the sum of a Cross-Entropy for the start and end positions.
- **start_logits** (`torch.FloatTensor` of shape `(batch_size, sequence_length)`) --
  Span-start scores (before SoftMax).
- **end_logits** (`torch.FloatTensor` of shape `(batch_size, sequence_length)`) --
  Span-end scores (before SoftMax).
- **past_key_values** (`EncoderDecoderCache`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`) --
  It is a `EncoderDecoderCache` instance. For more details, see our [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache).

  Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
  blocks) that can be used (see `past_key_values` input) to speed up sequential decoding.
- **decoder_hidden_states** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, +
  one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the decoder at the output of each layer plus the initial embedding outputs.
- **decoder_attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the decoder, after the attention softmax, used to compute the weighted average in the
  self-attention heads.
- **cross_attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the
  weighted average in the cross-attention heads.
- **encoder_last_hidden_state** (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*) --
  Sequence of hidden-states at the output of the last layer of the encoder of the model.
- **encoder_hidden_states** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, +
  one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the encoder at the output of each layer plus the initial embedding outputs.
- **encoder_attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the encoder, after the attention softmax, used to compute the weighted average in the
  self-attention heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for outputs of sequence-to-sequence question answering models.




</div>

## Seq2SeqSpectrogramOutput[[transformers.modeling_outputs.Seq2SeqSpectrogramOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_outputs.Seq2SeqSpectrogramOutput</name><anchor>transformers.modeling_outputs.Seq2SeqSpectrogramOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_outputs.py#L1470</source><parameters>[{"name": "loss", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "spectrogram", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "past_key_values", "val": ": typing.Optional[transformers.cache_utils.EncoderDecoderCache] = None"}, {"name": "decoder_hidden_states", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "decoder_attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "cross_attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "encoder_last_hidden_state", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "encoder_hidden_states", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "encoder_attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}]</parameters><paramsdesc>- **loss** (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided) --
  Spectrogram generation loss.
- **spectrogram** (`torch.FloatTensor` of shape `(batch_size, sequence_length, num_bins)`) --
  The predicted spectrogram.
- **past_key_values** (`EncoderDecoderCache`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`) --
  It is a `EncoderDecoderCache` instance. For more details, see our [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache).

  Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
  blocks) that can be used (see `past_key_values` input) to speed up sequential decoding.
- **decoder_hidden_states** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, +
  one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the decoder at the output of each layer plus the initial embedding outputs.
- **decoder_attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the decoder, after the attention softmax, used to compute the weighted average in the
  self-attention heads.
- **cross_attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the
  weighted average in the cross-attention heads.
- **encoder_last_hidden_state** (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*) --
  Sequence of hidden-states at the output of the last layer of the encoder of the model.
- **encoder_hidden_states** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, +
  one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the encoder at the output of each layer plus the initial embedding outputs.
- **encoder_attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the encoder, after the attention softmax, used to compute the weighted average in the
  self-attention heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for sequence-to-sequence spectrogram outputs.




</div>

## SemanticSegmenterOutput[[transformers.modeling_outputs.SemanticSegmenterOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_outputs.SemanticSegmenterOutput</name><anchor>transformers.modeling_outputs.SemanticSegmenterOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_outputs.py#L1200</source><parameters>[{"name": "loss", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "logits", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "hidden_states", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}]</parameters><paramsdesc>- **loss** (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided) --
  Classification (or regression if config.num_labels==1) loss.
- **logits** (`torch.FloatTensor` of shape `(batch_size, config.num_labels, logits_height, logits_width)`) --
  Classification scores for each pixel.

  <Tip warning={true}>

  The logits returned do not necessarily have the same size as the `pixel_values` passed as inputs. This is
  to avoid doing two interpolations and lose some quality when a user needs to resize the logits to the
  original image size as post-processing. You should always check your logits shape and resize as needed.

  </Tip>

- **hidden_states** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, +
  one for the output of each layer) of shape `(batch_size, patch_size, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.
- **attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, patch_size,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for outputs of semantic segmentation models.




</div>

## ImageClassifierOutput[[transformers.modeling_outputs.ImageClassifierOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_outputs.ImageClassifierOutput</name><anchor>transformers.modeling_outputs.ImageClassifierOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_outputs.py#L1238</source><parameters>[{"name": "loss", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "logits", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "hidden_states", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}]</parameters><paramsdesc>- **loss** (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided) --
  Classification (or regression if config.num_labels==1) loss.
- **logits** (`torch.FloatTensor` of shape `(batch_size, config.num_labels)`) --
  Classification (or regression if config.num_labels==1) scores (before SoftMax).
- **hidden_states** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, +
  one for the output of each stage) of shape `(batch_size, sequence_length, hidden_size)`. Hidden-states
  (also called feature maps) of the model at the output of each stage.
- **attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, patch_size,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for outputs of image classification models.




</div>

## ImageClassifierOutputWithNoAttention[[transformers.modeling_outputs.ImageClassifierOutputWithNoAttention]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_outputs.ImageClassifierOutputWithNoAttention</name><anchor>transformers.modeling_outputs.ImageClassifierOutputWithNoAttention</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_outputs.py#L1266</source><parameters>[{"name": "loss", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "logits", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "hidden_states", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}]</parameters><paramsdesc>- **loss** (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided) --
  Classification (or regression if config.num_labels==1) loss.
- **logits** (`torch.FloatTensor` of shape `(batch_size, config.num_labels)`) --
  Classification (or regression if config.num_labels==1) scores (before SoftMax).
- **hidden_states** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, +
  one for the output of each stage) of shape `(batch_size, num_channels, height, width)`. Hidden-states (also
  called feature maps) of the model at the output of each stage.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for outputs of image classification models.




</div>

## DepthEstimatorOutput[[transformers.modeling_outputs.DepthEstimatorOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_outputs.DepthEstimatorOutput</name><anchor>transformers.modeling_outputs.DepthEstimatorOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_outputs.py#L1287</source><parameters>[{"name": "loss", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "predicted_depth", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "hidden_states", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}]</parameters><paramsdesc>- **loss** (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided) --
  Classification (or regression if config.num_labels==1) loss.
- **predicted_depth** (`torch.FloatTensor` of shape `(batch_size, height, width)`) --
  Predicted depth for each pixel.

- **hidden_states** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, +
  one for the output of each layer) of shape `(batch_size, num_channels, height, width)`.

  Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.
- **attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, patch_size,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for outputs of depth estimation models.




</div>

## Wav2Vec2BaseModelOutput[[transformers.modeling_outputs.Wav2Vec2BaseModelOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_outputs.Wav2Vec2BaseModelOutput</name><anchor>transformers.modeling_outputs.Wav2Vec2BaseModelOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_outputs.py#L1345</source><parameters>[{"name": "last_hidden_state", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "extract_features", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "hidden_states", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}]</parameters><paramsdesc>- **last_hidden_state** (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`) --
  Sequence of hidden-states at the output of the last layer of the model.
- **extract_features** (`torch.FloatTensor` of shape `(batch_size, sequence_length, conv_dim[-1])`) --
  Sequence of extracted feature vectors of the last convolutional layer of the model.
- **hidden_states** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `torch.FloatTensor` (one for the output of the embeddings + one for the output of each layer) of
  shape `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the initial embedding outputs.
- **attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for models that have been trained with the Wav2Vec2 loss objective.




</div>

## XVectorOutput[[transformers.modeling_outputs.XVectorOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_outputs.XVectorOutput</name><anchor>transformers.modeling_outputs.XVectorOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_outputs.py#L1374</source><parameters>[{"name": "loss", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "logits", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "embeddings", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "hidden_states", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}]</parameters><paramsdesc>- **loss** (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided) --
  Classification loss.
- **logits** (`torch.FloatTensor` of shape `(batch_size, config.xvector_output_dim)`) --
  Classification hidden states before AMSoftmax.
- **embeddings** (`torch.FloatTensor` of shape `(batch_size, config.xvector_output_dim)`) --
  Utterance embeddings used for vector similarity-based retrieval.
- **hidden_states** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `torch.FloatTensor` (one for the output of the embeddings + one for the output of each layer) of
  shape `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the initial embedding outputs.
- **attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Output type of `Wav2Vec2ForXVector`.




</div>

## Seq2SeqTSModelOutput[[transformers.modeling_outputs.Seq2SeqTSModelOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_outputs.Seq2SeqTSModelOutput</name><anchor>transformers.modeling_outputs.Seq2SeqTSModelOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_outputs.py#L1528</source><parameters>[{"name": "last_hidden_state", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "past_key_values", "val": ": typing.Optional[transformers.cache_utils.EncoderDecoderCache] = None"}, {"name": "decoder_hidden_states", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "decoder_attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "cross_attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "encoder_last_hidden_state", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "encoder_hidden_states", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "encoder_attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "loc", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "scale", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "static_features", "val": ": typing.Optional[torch.FloatTensor] = None"}]</parameters><paramsdesc>- **last_hidden_state** (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`) --
  Sequence of hidden-states at the output of the last layer of the decoder of the model.

  If `past_key_values` is used only the last hidden-state of the sequences of shape `(batch_size, 1,
  hidden_size)` is output.
- **past_key_values** (`EncoderDecoderCache`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`) --
  It is a `EncoderDecoderCache` instance. For more details, see our [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache).

  Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
  blocks) that can be used (see `past_key_values` input) to speed up sequential decoding.
- **decoder_hidden_states** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, +
  one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the decoder at the output of each layer plus the optional initial embedding outputs.
- **decoder_attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the decoder, after the attention softmax, used to compute the weighted average in the
  self-attention heads.
- **cross_attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the
  weighted average in the cross-attention heads.
- **encoder_last_hidden_state** (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*) --
  Sequence of hidden-states at the output of the last layer of the encoder of the model.
- **encoder_hidden_states** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, +
  one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the encoder at the output of each layer plus the optional initial embedding outputs.
- **encoder_attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the encoder, after the attention softmax, used to compute the weighted average in the
  self-attention heads.
- **loc** (`torch.FloatTensor` of shape `(batch_size,)` or `(batch_size, input_size)`, *optional*) --
  Shift values of each time series' context window which is used to give the model inputs of the same
  magnitude and then used to shift back to the original magnitude.
- **scale** (`torch.FloatTensor` of shape `(batch_size,)` or `(batch_size, input_size)`, *optional*) --
  Scaling values of each time series' context window which is used to give the model inputs of the same
  magnitude and then used to rescale back to the original magnitude.
- **static_features** (`torch.FloatTensor` of shape `(batch_size, feature size)`, *optional*) --
  Static features of each time series' in a batch which are copied to the covariates at inference time.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for time series model's encoder outputs that also contains pre-computed hidden states that can speed up
sequential decoding.




</div>

## Seq2SeqTSPredictionOutput[[transformers.modeling_outputs.Seq2SeqTSPredictionOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_outputs.Seq2SeqTSPredictionOutput</name><anchor>transformers.modeling_outputs.Seq2SeqTSPredictionOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_outputs.py#L1598</source><parameters>[{"name": "loss", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "params", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "past_key_values", "val": ": typing.Optional[transformers.cache_utils.EncoderDecoderCache] = None"}, {"name": "decoder_hidden_states", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "decoder_attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "cross_attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "encoder_last_hidden_state", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "encoder_hidden_states", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "encoder_attentions", "val": ": typing.Optional[tuple[torch.FloatTensor, ...]] = None"}, {"name": "loc", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "scale", "val": ": typing.Optional[torch.FloatTensor] = None"}, {"name": "static_features", "val": ": typing.Optional[torch.FloatTensor] = None"}]</parameters><paramsdesc>- **loss** (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when a `future_values` is provided) --
  Distributional loss.
- **params** (`torch.FloatTensor` of shape `(batch_size, num_samples, num_params)`) --
  Parameters of the chosen distribution.
- **past_key_values** (`EncoderDecoderCache`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`) --
  It is a `EncoderDecoderCache` instance. For more details, see our [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache).

  Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
  blocks) that can be used (see `past_key_values` input) to speed up sequential decoding.
- **decoder_hidden_states** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, +
  one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the decoder at the output of each layer plus the initial embedding outputs.
- **decoder_attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the decoder, after the attention softmax, used to compute the weighted average in the
  self-attention heads.
- **cross_attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the
  weighted average in the cross-attention heads.
- **encoder_last_hidden_state** (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*) --
  Sequence of hidden-states at the output of the last layer of the encoder of the model.
- **encoder_hidden_states** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, +
  one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the encoder at the output of each layer plus the initial embedding outputs.
- **encoder_attentions** (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the encoder, after the attention softmax, used to compute the weighted average in the
  self-attention heads.
- **loc** (`torch.FloatTensor` of shape `(batch_size,)` or `(batch_size, input_size)`, *optional*) --
  Shift values of each time series' context window which is used to give the model inputs of the same
  magnitude and then used to shift back to the original magnitude.
- **scale** (`torch.FloatTensor` of shape `(batch_size,)` or `(batch_size, input_size)`, *optional*) --
  Scaling values of each time series' context window which is used to give the model inputs of the same
  magnitude and then used to rescale back to the original magnitude.
- **static_features** (`torch.FloatTensor` of shape `(batch_size, feature size)`, *optional*) --
  Static features of each time series' in a batch which are copied to the covariates at inference time.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for time series model's decoder outputs that also contain the loss as well as the parameters of the
chosen distribution.




</div>

## SampleTSPredictionOutput[[transformers.modeling_outputs.SampleTSPredictionOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_outputs.SampleTSPredictionOutput</name><anchor>transformers.modeling_outputs.SampleTSPredictionOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_outputs.py#L1668</source><parameters>[{"name": "sequences", "val": ": typing.Optional[torch.FloatTensor] = None"}]</parameters><paramsdesc>- **sequences** (`torch.FloatTensor` of shape `(batch_size, num_samples, prediction_length)` or `(batch_size, num_samples, prediction_length, input_size)`) --
  Sampled values from the chosen distribution.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for time series model's predictions outputs that contains the sampled values from the chosen
distribution.




</div>

## TFBaseModelOutput[[transformers.modeling_tf_outputs.TFBaseModelOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_tf_outputs.TFBaseModelOutput</name><anchor>transformers.modeling_tf_outputs.TFBaseModelOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_tf_outputs.py#L26</source><parameters>[{"name": "last_hidden_state", "val": ": tf.Tensor | None = None"}, {"name": "hidden_states", "val": ": tuple[tf.Tensor] | None = None"}, {"name": "attentions", "val": ": tuple[tf.Tensor] | None = None"}]</parameters><paramsdesc>- **last_hidden_state** (`tf.Tensor` of shape `(batch_size, sequence_length, hidden_size)`) --
  Sequence of hidden-states at the output of the last layer of the model.
- **hidden_states** (`tuple(tf.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `tf.Tensor` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the initial embedding outputs.
- **attentions** (`tuple(tf.Tensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `tf.Tensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for model's outputs, with potential hidden states and attentions.




</div>

## TFBaseModelOutputWithPooling[[transformers.modeling_tf_outputs.TFBaseModelOutputWithPooling]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_tf_outputs.TFBaseModelOutputWithPooling</name><anchor>transformers.modeling_tf_outputs.TFBaseModelOutputWithPooling</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_tf_outputs.py#L71</source><parameters>[{"name": "last_hidden_state", "val": ": tf.Tensor | None = None"}, {"name": "pooler_output", "val": ": tf.Tensor | None = None"}, {"name": "hidden_states", "val": ": tuple[tf.Tensor] | None = None"}, {"name": "attentions", "val": ": tuple[tf.Tensor] | None = None"}]</parameters><paramsdesc>- **last_hidden_state** (`tf.Tensor` of shape `(batch_size, sequence_length, hidden_size)`) --
  Sequence of hidden-states at the output of the last layer of the model.
- **pooler_output** (`tf.Tensor` of shape `(batch_size, hidden_size)`) --
  Last layer hidden-state of the first token of the sequence (classification token) further processed by a
  Linear layer and a Tanh activation function. The Linear layer weights are trained from the next sentence
  prediction (classification) objective during pretraining.

  This output is usually *not* a good summary of the semantic content of the input, you're often better with
  averaging or pooling the sequence of hidden-states for the whole input sequence.
- **hidden_states** (`tuple(tf.Tensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `tf.Tensor` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the initial embedding outputs.
- **attentions** (`tuple(tf.Tensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `tf.Tensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for model's outputs that also contains a pooling of the last hidden states.




</div>

## TFBaseModelOutputWithPoolingAndCrossAttentions[[transformers.modeling_tf_outputs.TFBaseModelOutputWithPoolingAndCrossAttentions]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_tf_outputs.TFBaseModelOutputWithPoolingAndCrossAttentions</name><anchor>transformers.modeling_tf_outputs.TFBaseModelOutputWithPoolingAndCrossAttentions</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_tf_outputs.py#L127</source><parameters>[{"name": "last_hidden_state", "val": ": tf.Tensor | None = None"}, {"name": "pooler_output", "val": ": tf.Tensor | None = None"}, {"name": "past_key_values", "val": ": list[tf.Tensor] | None = None"}, {"name": "hidden_states", "val": ": tuple[tf.Tensor] | None = None"}, {"name": "attentions", "val": ": tuple[tf.Tensor] | None = None"}, {"name": "cross_attentions", "val": ": tuple[tf.Tensor] | None = None"}]</parameters><paramsdesc>- **last_hidden_state** (`tf.Tensor` of shape `(batch_size, sequence_length, hidden_size)`) --
  Sequence of hidden-states at the output of the last layer of the model.
- **pooler_output** (`tf.Tensor` of shape `(batch_size, hidden_size)`) --
  Last layer hidden-state of the first token of the sequence (classification token) further processed by a
  Linear layer and a Tanh activation function. The Linear layer weights are trained from the next sentence
  prediction (classification) objective during pretraining.

  This output is usually *not* a good summary of the semantic content of the input, you're often better with
  averaging or pooling the sequence of hidden-states for the whole input sequence.
- **past_key_values** (`list[tf.Tensor]`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`) --
  List of `tf.Tensor` of length `config.n_layers`, with each tensor of shape `(2, batch_size, num_heads,
  sequence_length, embed_size_per_head)`).

  Contains pre-computed hidden-states (key and values in the attention blocks) that can be used (see
  `past_key_values` input) to speed up sequential decoding.
- **hidden_states** (`tuple(tf.Tensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `tf.Tensor` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the initial embedding outputs.
- **attentions** (`tuple(tf.Tensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `tf.Tensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.
- **cross_attentions** (`tuple(tf.Tensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `tf.Tensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the
  weighted average in the cross-attention heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for model's outputs that also contains a pooling of the last hidden states.




</div>

## TFBaseModelOutputWithPast[[transformers.modeling_tf_outputs.TFBaseModelOutputWithPast]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_tf_outputs.TFBaseModelOutputWithPast</name><anchor>transformers.modeling_tf_outputs.TFBaseModelOutputWithPast</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_tf_outputs.py#L175</source><parameters>[{"name": "last_hidden_state", "val": ": tf.Tensor | None = None"}, {"name": "past_key_values", "val": ": list[tf.Tensor] | None = None"}, {"name": "hidden_states", "val": ": tuple[tf.Tensor] | None = None"}, {"name": "attentions", "val": ": tuple[tf.Tensor] | None = None"}]</parameters><paramsdesc>- **last_hidden_state** (`tf.Tensor` of shape `(batch_size, sequence_length, hidden_size)`) --
  Sequence of hidden-states at the output of the last layer of the model.

  If `past_key_values` is used only the last hidden-state of the sequences of shape `(batch_size, 1,
  hidden_size)` is output.
- **past_key_values** (`list[tf.Tensor]`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`) --
  List of `tf.Tensor` of length `config.n_layers`, with each tensor of shape `(2, batch_size, num_heads,
  sequence_length, embed_size_per_head)`).

  Contains pre-computed hidden-states (key and values in the attention blocks) that can be used (see
  `past_key_values` input) to speed up sequential decoding.
- **hidden_states** (`tuple(tf.Tensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `tf.Tensor` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the initial embedding outputs.
- **attentions** (`tuple(tf.Tensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `tf.Tensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for model's outputs that may also contain a past key/values (to speed up sequential decoding).




</div>

## TFBaseModelOutputWithPastAndCrossAttentions[[transformers.modeling_tf_outputs.TFBaseModelOutputWithPastAndCrossAttentions]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_tf_outputs.TFBaseModelOutputWithPastAndCrossAttentions</name><anchor>transformers.modeling_tf_outputs.TFBaseModelOutputWithPastAndCrossAttentions</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_tf_outputs.py#L244</source><parameters>[{"name": "last_hidden_state", "val": ": tf.Tensor | None = None"}, {"name": "past_key_values", "val": ": list[tf.Tensor] | None = None"}, {"name": "hidden_states", "val": ": tuple[tf.Tensor] | None = None"}, {"name": "attentions", "val": ": tuple[tf.Tensor] | None = None"}, {"name": "cross_attentions", "val": ": tuple[tf.Tensor] | None = None"}]</parameters><paramsdesc>- **last_hidden_state** (`tf.Tensor` of shape `(batch_size, sequence_length, hidden_size)`) --
  Sequence of hidden-states at the output of the last layer of the model.

  If `past_key_values` is used only the last hidden-state of the sequences of shape `(batch_size, 1,
  hidden_size)` is output.
- **past_key_values** (`list[tf.Tensor]`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`) --
  List of `tf.Tensor` of length `config.n_layers`, with each tensor of shape `(2, batch_size, num_heads,
  sequence_length, embed_size_per_head)`).

  Contains pre-computed hidden-states (key and values in the attention blocks) that can be used (see
  `past_key_values` input) to speed up sequential decoding.
- **hidden_states** (`tuple(tf.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `tf.Tensor` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the initial embedding outputs.
- **attentions** (`tuple(tf.Tensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `tf.Tensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.
- **cross_attentions** (`tuple(tf.Tensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `tf.Tensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the
  weighted average in the cross-attention heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for model's outputs that may also contain a past key/values (to speed up sequential decoding).




</div>

## TFSeq2SeqModelOutput[[transformers.modeling_tf_outputs.TFSeq2SeqModelOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_tf_outputs.TFSeq2SeqModelOutput</name><anchor>transformers.modeling_tf_outputs.TFSeq2SeqModelOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_tf_outputs.py#L287</source><parameters>[{"name": "last_hidden_state", "val": ": tf.Tensor | None = None"}, {"name": "past_key_values", "val": ": list[tf.Tensor] | None = None"}, {"name": "decoder_hidden_states", "val": ": tuple[tf.Tensor] | None = None"}, {"name": "decoder_attentions", "val": ": tuple[tf.Tensor] | None = None"}, {"name": "cross_attentions", "val": ": tuple[tf.Tensor] | None = None"}, {"name": "encoder_last_hidden_state", "val": ": tf.Tensor | None = None"}, {"name": "encoder_hidden_states", "val": ": tuple[tf.Tensor] | None = None"}, {"name": "encoder_attentions", "val": ": tuple[tf.Tensor] | None = None"}]</parameters><paramsdesc>- **last_hidden_state** (`tf.Tensor` of shape `(batch_size, sequence_length, hidden_size)`) --
  Sequence of hidden-states at the output of the last layer of the decoder of the model.

  If `past_key_values` is used only the last hidden-state of the sequences of shape `(batch_size, 1,
  hidden_size)` is output.
- **past_key_values** (`list[tf.Tensor]`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`) --
  List of `tf.Tensor` of length `config.n_layers`, with each tensor of shape `(2, batch_size, num_heads,
  sequence_length, embed_size_per_head)`).

  Contains pre-computed hidden-states (key and values in the attention blocks) of the decoder that can be
  used (see `past_key_values` input) to speed up sequential decoding.
- **decoder_hidden_states** (`tuple(tf.Tensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `tf.Tensor` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the decoder at the output of each layer plus the initial embedding outputs.
- **decoder_attentions** (`tuple(tf.Tensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `tf.Tensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the decoder, after the attention softmax, used to compute the weighted average in the
  self-attention heads.
- **cross_attentions** (`tuple(tf.Tensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `tf.Tensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the
  weighted average in the cross-attention heads.
- **encoder_last_hidden_state** (`tf.Tensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*) --
  Sequence of hidden-states at the output of the last layer of the encoder of the model.
- **encoder_hidden_states** (`tuple(tf.Tensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `tf.Tensor` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the encoder at the output of each layer plus the initial embedding outputs.
- **encoder_attentions** (`tuple(tf.Tensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `tf.Tensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the encoder, after the attention softmax, used to compute the weighted average in the
  self-attention heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for model encoder's outputs that also contains : pre-computed hidden states that can speed up sequential
decoding.




</div>

## TFCausalLMOutput[[transformers.modeling_tf_outputs.TFCausalLMOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_tf_outputs.TFCausalLMOutput</name><anchor>transformers.modeling_tf_outputs.TFCausalLMOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_tf_outputs.py#L347</source><parameters>[{"name": "loss", "val": ": tf.Tensor | None = None"}, {"name": "logits", "val": ": tf.Tensor | None = None"}, {"name": "hidden_states", "val": ": tuple[tf.Tensor] | None = None"}, {"name": "attentions", "val": ": tuple[tf.Tensor] | None = None"}]</parameters><paramsdesc>- **loss** (`tf.Tensor` of shape `(n,)`, *optional*, where n is the number of non-masked labels, returned when `labels` is provided) --
  Language modeling loss (for next-token prediction).
- **logits** (`tf.Tensor` of shape `(batch_size, sequence_length, config.vocab_size)`) --
  Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).
- **hidden_states** (`tuple(tf.Tensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `tf.Tensor` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the initial embedding outputs.
- **attentions** (`tuple(tf.Tensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `tf.Tensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for causal language model (or autoregressive) outputs.




</div>

## TFCausalLMOutputWithCrossAttentions[[transformers.modeling_tf_outputs.TFCausalLMOutputWithCrossAttentions]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_tf_outputs.TFCausalLMOutputWithCrossAttentions</name><anchor>transformers.modeling_tf_outputs.TFCausalLMOutputWithCrossAttentions</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_tf_outputs.py#L412</source><parameters>[{"name": "loss", "val": ": tf.Tensor | None = None"}, {"name": "logits", "val": ": tf.Tensor | None = None"}, {"name": "past_key_values", "val": ": list[tf.Tensor] | None = None"}, {"name": "hidden_states", "val": ": tuple[tf.Tensor] | None = None"}, {"name": "attentions", "val": ": tuple[tf.Tensor] | None = None"}, {"name": "cross_attentions", "val": ": tuple[tf.Tensor] | None = None"}]</parameters><paramsdesc>- **loss** (`tf.Tensor` of shape `(n,)`, *optional*, where n is the number of non-masked labels, returned when `labels` is provided) --
  Language modeling loss (for next-token prediction).
- **logits** (`tf.Tensor` of shape `(batch_size, sequence_length, config.vocab_size)`) --
  Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).
- **hidden_states** (`tuple(tf.Tensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `tf.Tensor` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the initial embedding outputs.
- **attentions** (`tuple(tf.Tensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `tf.Tensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.
- **cross_attentions** (`tuple(tf.Tensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `tf.Tensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the
  weighted average in the cross-attention heads.
- **past_key_values** (`list[tf.Tensor]`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`) --
  List of `tf.Tensor` of length `config.n_layers`, with each tensor of shape `(2, batch_size, num_heads,
  sequence_length, embed_size_per_head)`).

  Contains pre-computed hidden-states (key and values in the attention blocks) that can be used (see
  `past_key_values` input) to speed up sequential decoding.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for causal language model (or autoregressive) outputs.




</div>

## TFCausalLMOutputWithPast[[transformers.modeling_tf_outputs.TFCausalLMOutputWithPast]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_tf_outputs.TFCausalLMOutputWithPast</name><anchor>transformers.modeling_tf_outputs.TFCausalLMOutputWithPast</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_tf_outputs.py#L376</source><parameters>[{"name": "loss", "val": ": tf.Tensor | None = None"}, {"name": "logits", "val": ": tf.Tensor | None = None"}, {"name": "past_key_values", "val": ": list[tf.Tensor] | None = None"}, {"name": "hidden_states", "val": ": tuple[tf.Tensor] | None = None"}, {"name": "attentions", "val": ": tuple[tf.Tensor] | None = None"}]</parameters><paramsdesc>- **loss** (`tf.Tensor` of shape `(n,)`, *optional*, where n is the number of non-masked labels, returned when `labels` is provided) --
  Language modeling loss (for next-token prediction).
- **logits** (`tf.Tensor` of shape `(batch_size, sequence_length, config.vocab_size)`) --
  Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).
- **past_key_values** (`list[tf.Tensor]`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`) --
  List of `tf.Tensor` of length `config.n_layers`, with each tensor of shape `(2, batch_size, num_heads,
  sequence_length, embed_size_per_head)`).

  Contains pre-computed hidden-states (key and values in the attention blocks) that can be used (see
  `past_key_values` input) to speed up sequential decoding.
- **hidden_states** (`tuple(tf.Tensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `tf.Tensor` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the initial embedding outputs.
- **attentions** (`tuple(tf.Tensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `tf.Tensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for causal language model (or autoregressive) outputs.




</div>

## TFMaskedLMOutput[[transformers.modeling_tf_outputs.TFMaskedLMOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_tf_outputs.TFMaskedLMOutput</name><anchor>transformers.modeling_tf_outputs.TFMaskedLMOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_tf_outputs.py#L455</source><parameters>[{"name": "loss", "val": ": tf.Tensor | None = None"}, {"name": "logits", "val": ": tf.Tensor | None = None"}, {"name": "hidden_states", "val": ": tuple[tf.Tensor] | None = None"}, {"name": "attentions", "val": ": tuple[tf.Tensor] | None = None"}]</parameters><paramsdesc>- **loss** (`tf.Tensor` of shape `(n,)`, *optional*, where n is the number of non-masked labels, returned when `labels` is provided) --
  Masked language modeling (MLM) loss.
- **logits** (`tf.Tensor` of shape `(batch_size, sequence_length, config.vocab_size)`) --
  Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).
- **hidden_states** (`tuple(tf.Tensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `tf.Tensor` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the initial embedding outputs.
- **attentions** (`tuple(tf.Tensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `tf.Tensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for masked language models outputs.




</div>

## TFSeq2SeqLMOutput[[transformers.modeling_tf_outputs.TFSeq2SeqLMOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_tf_outputs.TFSeq2SeqLMOutput</name><anchor>transformers.modeling_tf_outputs.TFSeq2SeqLMOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_tf_outputs.py#L484</source><parameters>[{"name": "loss", "val": ": tf.Tensor | None = None"}, {"name": "logits", "val": ": tf.Tensor | None = None"}, {"name": "past_key_values", "val": ": list[tf.Tensor] | None = None"}, {"name": "decoder_hidden_states", "val": ": tuple[tf.Tensor] | None = None"}, {"name": "decoder_attentions", "val": ": tuple[tf.Tensor] | None = None"}, {"name": "cross_attentions", "val": ": tuple[tf.Tensor] | None = None"}, {"name": "encoder_last_hidden_state", "val": ": tf.Tensor | None = None"}, {"name": "encoder_hidden_states", "val": ": tuple[tf.Tensor] | None = None"}, {"name": "encoder_attentions", "val": ": tuple[tf.Tensor] | None = None"}]</parameters><paramsdesc>- **loss** (`tf.Tensor` of shape `(n,)`, *optional*, where n is the number of non-masked labels, returned when `labels` is provided) --
  Language modeling loss.
- **logits** (`tf.Tensor` of shape `(batch_size, sequence_length, config.vocab_size)`) --
  Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).
- **past_key_values** (`list[tf.Tensor]`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`) --
  List of `tf.Tensor` of length `config.n_layers`, with each tensor of shape `(2, batch_size, num_heads,
  sequence_length, embed_size_per_head)`).

  Contains pre-computed hidden-states (key and values in the attention blocks) of the decoder that can be
  used (see `past_key_values` input) to speed up sequential decoding.
- **decoder_hidden_states** (`tuple(tf.Tensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `tf.Tensor` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the decoder at the output of each layer plus the initial embedding outputs.
- **decoder_attentions** (`tuple(tf.Tensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `tf.Tensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the decoder, after the attention softmax, used to compute the weighted average in the
  self-attention heads.
- **cross_attentions** (`tuple(tf.Tensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `tf.Tensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the
  weighted average in the cross-attention heads.
- **encoder_last_hidden_state** (`tf.Tensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*) --
  Sequence of hidden-states at the output of the last layer of the encoder of the model.
- **encoder_hidden_states** (`tuple(tf.Tensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `tf.Tensor` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the encoder at the output of each layer plus the initial embedding outputs.
- **encoder_attentions** (`tuple(tf.Tensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `tf.Tensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the encoder, after the attention softmax, used to compute the weighted average in the
  self-attention heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for sequence-to-sequence language models outputs.




</div>

## TFNextSentencePredictorOutput[[transformers.modeling_tf_outputs.TFNextSentencePredictorOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_tf_outputs.TFNextSentencePredictorOutput</name><anchor>transformers.modeling_tf_outputs.TFNextSentencePredictorOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_tf_outputs.py#L543</source><parameters>[{"name": "loss", "val": ": tf.Tensor | None = None"}, {"name": "logits", "val": ": tf.Tensor | None = None"}, {"name": "hidden_states", "val": ": tuple[tf.Tensor] | None = None"}, {"name": "attentions", "val": ": tuple[tf.Tensor] | None = None"}]</parameters><paramsdesc>- **loss** (`tf.Tensor` of shape `(n,)`, *optional*, where n is the number of non-masked labels, returned when `next_sentence_label` is provided) --
  Next sentence prediction loss.
- **logits** (`tf.Tensor` of shape `(batch_size, 2)`) --
  Prediction scores of the next sequence prediction (classification) head (scores of True/False continuation
  before SoftMax).
- **hidden_states** (`tuple(tf.Tensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `tf.Tensor` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the initial embedding outputs.
- **attentions** (`tuple(tf.Tensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `tf.Tensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for outputs of models predicting if two sentences are consecutive or not.




</div>

## TFSequenceClassifierOutput[[transformers.modeling_tf_outputs.TFSequenceClassifierOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_tf_outputs.TFSequenceClassifierOutput</name><anchor>transformers.modeling_tf_outputs.TFSequenceClassifierOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_tf_outputs.py#L573</source><parameters>[{"name": "loss", "val": ": tf.Tensor | None = None"}, {"name": "logits", "val": ": tf.Tensor | None = None"}, {"name": "hidden_states", "val": ": tuple[tf.Tensor] | None = None"}, {"name": "attentions", "val": ": tuple[tf.Tensor] | None = None"}]</parameters><paramsdesc>- **loss** (`tf.Tensor` of shape `(batch_size, )`, *optional*, returned when `labels` is provided) --
  Classification (or regression if config.num_labels==1) loss.
- **logits** (`tf.Tensor` of shape `(batch_size, config.num_labels)`) --
  Classification (or regression if config.num_labels==1) scores (before SoftMax).
- **hidden_states** (`tuple(tf.Tensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `tf.Tensor` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the initial embedding outputs.
- **attentions** (`tuple(tf.Tensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `tf.Tensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for outputs of sentence classification models.




</div>

## TFSeq2SeqSequenceClassifierOutput[[transformers.modeling_tf_outputs.TFSeq2SeqSequenceClassifierOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_tf_outputs.TFSeq2SeqSequenceClassifierOutput</name><anchor>transformers.modeling_tf_outputs.TFSeq2SeqSequenceClassifierOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_tf_outputs.py#L602</source><parameters>[{"name": "loss", "val": ": tf.Tensor | None = None"}, {"name": "logits", "val": ": tf.Tensor | None = None"}, {"name": "past_key_values", "val": ": list[tf.Tensor] | None = None"}, {"name": "decoder_hidden_states", "val": ": tuple[tf.Tensor] | None = None"}, {"name": "decoder_attentions", "val": ": tuple[tf.Tensor] | None = None"}, {"name": "cross_attentions", "val": ": tuple[tf.Tensor] | None = None"}, {"name": "encoder_last_hidden_state", "val": ": tf.Tensor | None = None"}, {"name": "encoder_hidden_states", "val": ": tuple[tf.Tensor] | None = None"}, {"name": "encoder_attentions", "val": ": tuple[tf.Tensor] | None = None"}]</parameters><paramsdesc>- **loss** (`tf.Tensor` of shape `(1,)`, *optional*, returned when `label` is provided) --
  Classification (or regression if config.num_labels==1) loss.
- **logits** (`tf.Tensor` of shape `(batch_size, config.num_labels)`) --
  Classification (or regression if config.num_labels==1) scores (before SoftMax).
- **past_key_values** (`list[tf.Tensor]`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`) --
  List of `tf.Tensor` of length `config.n_layers`, with each tensor of shape `(2, batch_size, num_heads,
  sequence_length, embed_size_per_head)`).

  Contains pre-computed hidden-states (key and values in the attention blocks) of the decoder that can be
  used (see `past_key_values` input) to speed up sequential decoding.
- **decoder_hidden_states** (`tuple(tf.Tensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `tf.Tensor` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the decoder at the output of each layer plus the initial embedding outputs.
- **decoder_attentions** (`tuple(tf.Tensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `tf.Tensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the decoder, after the attention softmax, used to compute the weighted average in the
  self-attention heads.
- **cross_attentions** (`tuple(tf.Tensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `tf.Tensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`
- **encoder_last_hidden_state** (`tf.Tensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*) --
  Sequence of hidden-states at the output of the last layer of the encoder of the model.
- **encoder_hidden_states** (`tuple(tf.Tensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `tf.Tensor` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the encoder at the output of each layer plus the initial embedding outputs.
- **encoder_attentions** (`tuple(tf.Tensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `tf.Tensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the encoder, after the attention softmax, used to compute the weighted average in the
  self-attention heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for outputs of sequence-to-sequence sentence classification models.




</div>

## TFMultipleChoiceModelOutput[[transformers.modeling_tf_outputs.TFMultipleChoiceModelOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_tf_outputs.TFMultipleChoiceModelOutput</name><anchor>transformers.modeling_tf_outputs.TFMultipleChoiceModelOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_tf_outputs.py#L753</source><parameters>[{"name": "loss", "val": ": tf.Tensor | None = None"}, {"name": "logits", "val": ": tf.Tensor | None = None"}, {"name": "hidden_states", "val": ": tuple[tf.Tensor] | None = None"}, {"name": "attentions", "val": ": tuple[tf.Tensor] | None = None"}]</parameters><paramsdesc>- **loss** (`tf.Tensor` of shape *(batch_size, )*, *optional*, returned when `labels` is provided) --
  Classification loss.
- **logits** (`tf.Tensor` of shape `(batch_size, num_choices)`) --
  *num_choices* is the second dimension of the input tensors. (see *input_ids* above).

  Classification scores (before SoftMax).
- **hidden_states** (`tuple(tf.Tensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `tf.Tensor` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the initial embedding outputs.
- **attentions** (`tuple(tf.Tensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `tf.Tensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for outputs of multiple choice models.




</div>

## TFTokenClassifierOutput[[transformers.modeling_tf_outputs.TFTokenClassifierOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_tf_outputs.TFTokenClassifierOutput</name><anchor>transformers.modeling_tf_outputs.TFTokenClassifierOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_tf_outputs.py#L784</source><parameters>[{"name": "loss", "val": ": tf.Tensor | None = None"}, {"name": "logits", "val": ": tf.Tensor | None = None"}, {"name": "hidden_states", "val": ": tuple[tf.Tensor] | None = None"}, {"name": "attentions", "val": ": tuple[tf.Tensor] | None = None"}]</parameters><paramsdesc>- **loss** (`tf.Tensor` of shape `(n,)`, *optional*, where n is the number of unmasked labels, returned when `labels` is provided)  --
  Classification loss.
- **logits** (`tf.Tensor` of shape `(batch_size, sequence_length, config.num_labels)`) --
  Classification scores (before SoftMax).
- **hidden_states** (`tuple(tf.Tensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `tf.Tensor` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the initial embedding outputs.
- **attentions** (`tuple(tf.Tensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `tf.Tensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for outputs of token classification models.




</div>

## TFQuestionAnsweringModelOutput[[transformers.modeling_tf_outputs.TFQuestionAnsweringModelOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_tf_outputs.TFQuestionAnsweringModelOutput</name><anchor>transformers.modeling_tf_outputs.TFQuestionAnsweringModelOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_tf_outputs.py#L813</source><parameters>[{"name": "loss", "val": ": tf.Tensor | None = None"}, {"name": "start_logits", "val": ": tf.Tensor | None = None"}, {"name": "end_logits", "val": ": tf.Tensor | None = None"}, {"name": "hidden_states", "val": ": tuple[tf.Tensor] | None = None"}, {"name": "attentions", "val": ": tuple[tf.Tensor] | None = None"}]</parameters><paramsdesc>- **loss** (`tf.Tensor` of shape `(batch_size, )`, *optional*, returned when `start_positions` and `end_positions` are provided) --
  Total span extraction loss is the sum of a Cross-Entropy for the start and end positions.
- **start_logits** (`tf.Tensor` of shape `(batch_size, sequence_length)`) --
  Span-start scores (before SoftMax).
- **end_logits** (`tf.Tensor` of shape `(batch_size, sequence_length)`) --
  Span-end scores (before SoftMax).
- **hidden_states** (`tuple(tf.Tensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `tf.Tensor` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the initial embedding outputs.
- **attentions** (`tuple(tf.Tensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `tf.Tensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for outputs of question answering models.




</div>

## TFSeq2SeqQuestionAnsweringModelOutput[[transformers.modeling_tf_outputs.TFSeq2SeqQuestionAnsweringModelOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_tf_outputs.TFSeq2SeqQuestionAnsweringModelOutput</name><anchor>transformers.modeling_tf_outputs.TFSeq2SeqQuestionAnsweringModelOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_tf_outputs.py#L845</source><parameters>[{"name": "loss", "val": ": tf.Tensor | None = None"}, {"name": "start_logits", "val": ": tf.Tensor | None = None"}, {"name": "end_logits", "val": ": tf.Tensor | None = None"}, {"name": "past_key_values", "val": ": list[tf.Tensor] | None = None"}, {"name": "decoder_hidden_states", "val": ": tuple[tf.Tensor] | None = None"}, {"name": "decoder_attentions", "val": ": tuple[tf.Tensor] | None = None"}, {"name": "encoder_last_hidden_state", "val": ": tf.Tensor | None = None"}, {"name": "encoder_hidden_states", "val": ": tuple[tf.Tensor] | None = None"}, {"name": "encoder_attentions", "val": ": tuple[tf.Tensor] | None = None"}]</parameters><paramsdesc>- **loss** (`tf.Tensor` of shape `(1,)`, *optional*, returned when `labels` is provided) --
  Total span extraction loss is the sum of a Cross-Entropy for the start and end positions.
- **start_logits** (`tf.Tensor` of shape `(batch_size, sequence_length)`) --
  Span-start scores (before SoftMax).
- **end_logits** (`tf.Tensor` of shape `(batch_size, sequence_length)`) --
  Span-end scores (before SoftMax).
- **past_key_values** (`list[tf.Tensor]`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`) --
  List of `tf.Tensor` of length `config.n_layers`, with each tensor of shape `(2, batch_size, num_heads,
  sequence_length, embed_size_per_head)`).

  Contains pre-computed hidden-states (key and values in the attention blocks) of the decoder that can be
  used (see `past_key_values` input) to speed up sequential decoding.
- **decoder_hidden_states** (`tuple(tf.Tensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `tf.Tensor` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the decoder at the output of each layer plus the initial embedding outputs.
- **decoder_attentions** (`tuple(tf.Tensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `tf.Tensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the decoder, after the attention softmax, used to compute the weighted average in the
  self-attention heads.
- **encoder_last_hidden_state** (`tf.Tensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*) --
  Sequence of hidden-states at the output of the last layer of the encoder of the model.
- **encoder_hidden_states** (`tuple(tf.Tensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `tf.Tensor` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the encoder at the output of each layer plus the initial embedding outputs.
- **encoder_attentions** (`tuple(tf.Tensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `tf.Tensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the encoder, after the attention softmax, used to compute the weighted average in the
  self-attention heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for outputs of sequence-to-sequence question answering models.




</div>

## FlaxBaseModelOutput[[transformers.modeling_flax_outputs.FlaxBaseModelOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_flax_outputs.FlaxBaseModelOutput</name><anchor>transformers.modeling_flax_outputs.FlaxBaseModelOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_flax_outputs.py#L23</source><parameters>[{"name": "last_hidden_state", "val": ": typing.Optional[jax.Array] = None"}, {"name": "hidden_states", "val": ": typing.Optional[tuple[jax.Array]] = None"}, {"name": "attentions", "val": ": typing.Optional[tuple[jax.Array]] = None"}]</parameters><paramsdesc>- **last_hidden_state** (`jnp.ndarray` of shape `(batch_size, sequence_length, hidden_size)`) --
  Sequence of hidden-states at the output of the last layer of the model.
- **hidden_states** (`tuple(jnp.ndarray)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `jnp.ndarray` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the initial embedding outputs.
- **attentions** (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `jnp.ndarray` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for model's outputs, with potential hidden states and attentions.





<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>replace</name><anchor>transformers.modeling_flax_outputs.FlaxBaseModelOutput.replace</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/flax/struct.py#L111</source><parameters>[{"name": "**updates", "val": ""}]</parameters></docstring>
"Returns a new object replacing the specified fields with new values.

</div></div>

## FlaxBaseModelOutputWithPast[[transformers.modeling_flax_outputs.FlaxBaseModelOutputWithPast]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_flax_outputs.FlaxBaseModelOutputWithPast</name><anchor>transformers.modeling_flax_outputs.FlaxBaseModelOutputWithPast</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_flax_outputs.py#L107</source><parameters>[{"name": "last_hidden_state", "val": ": typing.Optional[jax.Array] = None"}, {"name": "past_key_values", "val": ": typing.Optional[dict[str, jax.Array]] = None"}, {"name": "hidden_states", "val": ": typing.Optional[tuple[jax.Array]] = None"}, {"name": "attentions", "val": ": typing.Optional[tuple[jax.Array]] = None"}]</parameters><paramsdesc>- **last_hidden_state** (`jnp.ndarray` of shape `(batch_size, sequence_length, hidden_size)`) --
  Sequence of hidden-states at the output of the last layer of the model.
- **past_key_values** (`dict[str, jnp.ndarray]`) --
  Dictionary of pre-computed hidden-states (key and values in the attention blocks) that can be used for fast
  auto-regressive decoding. Pre-computed key and value hidden-states are of shape *[batch_size, max_length]*.
- **hidden_states** (`tuple(jnp.ndarray)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `jnp.ndarray` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the initial embedding outputs.
- **attentions** (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `jnp.ndarray` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for model's outputs, with potential hidden states and attentions.





<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>replace</name><anchor>transformers.modeling_flax_outputs.FlaxBaseModelOutputWithPast.replace</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/flax/struct.py#L111</source><parameters>[{"name": "**updates", "val": ""}]</parameters></docstring>
"Returns a new object replacing the specified fields with new values.

</div></div>

## FlaxBaseModelOutputWithPooling[[transformers.modeling_flax_outputs.FlaxBaseModelOutputWithPooling]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_flax_outputs.FlaxBaseModelOutputWithPooling</name><anchor>transformers.modeling_flax_outputs.FlaxBaseModelOutputWithPooling</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_flax_outputs.py#L137</source><parameters>[{"name": "last_hidden_state", "val": ": typing.Optional[jax.Array] = None"}, {"name": "pooler_output", "val": ": typing.Optional[jax.Array] = None"}, {"name": "hidden_states", "val": ": typing.Optional[tuple[jax.Array]] = None"}, {"name": "attentions", "val": ": typing.Optional[tuple[jax.Array]] = None"}]</parameters><paramsdesc>- **last_hidden_state** (`jnp.ndarray` of shape `(batch_size, sequence_length, hidden_size)`) --
  Sequence of hidden-states at the output of the last layer of the model.
- **pooler_output** (`jnp.ndarray` of shape `(batch_size, hidden_size)`) --
  Last layer hidden-state of the first token of the sequence (classification token) further processed by a
  Linear layer and a Tanh activation function. The Linear layer weights are trained from the next sentence
  prediction (classification) objective during pretraining.
- **hidden_states** (`tuple(jnp.ndarray)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `jnp.ndarray` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the initial embedding outputs.
- **attentions** (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `jnp.ndarray` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for model's outputs that also contains a pooling of the last hidden states.





<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>replace</name><anchor>transformers.modeling_flax_outputs.FlaxBaseModelOutputWithPooling.replace</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/flax/struct.py#L111</source><parameters>[{"name": "**updates", "val": ""}]</parameters></docstring>
"Returns a new object replacing the specified fields with new values.

</div></div>

## FlaxBaseModelOutputWithPastAndCrossAttentions[[transformers.modeling_flax_outputs.FlaxBaseModelOutputWithPastAndCrossAttentions]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_flax_outputs.FlaxBaseModelOutputWithPastAndCrossAttentions</name><anchor>transformers.modeling_flax_outputs.FlaxBaseModelOutputWithPastAndCrossAttentions</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_flax_outputs.py#L217</source><parameters>[{"name": "last_hidden_state", "val": ": typing.Optional[jax.Array] = None"}, {"name": "past_key_values", "val": ": typing.Optional[tuple[tuple[jax.Array]]] = None"}, {"name": "hidden_states", "val": ": typing.Optional[tuple[jax.Array]] = None"}, {"name": "attentions", "val": ": typing.Optional[tuple[jax.Array]] = None"}, {"name": "cross_attentions", "val": ": typing.Optional[tuple[jax.Array]] = None"}]</parameters><paramsdesc>- **last_hidden_state** (`jnp.ndarray` of shape `(batch_size, sequence_length, hidden_size)`) --
  Sequence of hidden-states at the output of the last layer of the model.

  If `past_key_values` is used only the last hidden-state of the sequences of shape `(batch_size, 1,
  hidden_size)` is output.
- **past_key_values** (`tuple(tuple(jnp.ndarray))`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`) --
  Tuple of `tuple(jnp.ndarray)` of length `config.n_layers`, with each tuple having 2 tensors of shape
  `(batch_size, num_heads, sequence_length, embed_size_per_head)`) and optionally if
  `config.is_encoder_decoder=True` 2 additional tensors of shape `(batch_size, num_heads,
  encoder_sequence_length, embed_size_per_head)`.

  Contains pre-computed hidden-states (key and values in the self-attention blocks and optionally if
  `config.is_encoder_decoder=True` in the cross-attention blocks) that can be used (see `past_key_values`
  input) to speed up sequential decoding.
- **hidden_states** (`tuple(jnp.ndarray)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `jnp.ndarray` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the initial embedding outputs.
- **attentions** (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `jnp.ndarray` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.
- **cross_attentions** (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` and `config.add_cross_attention=True` is passed or when `config.output_attentions=True`) --
  Tuple of `jnp.ndarray` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the
  weighted average in the cross-attention heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for model's outputs that may also contain a past key/values (to speed up sequential decoding).





<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>replace</name><anchor>transformers.modeling_flax_outputs.FlaxBaseModelOutputWithPastAndCrossAttentions.replace</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/flax/struct.py#L111</source><parameters>[{"name": "**updates", "val": ""}]</parameters></docstring>
"Returns a new object replacing the specified fields with new values.

</div></div>

## FlaxSeq2SeqModelOutput[[transformers.modeling_flax_outputs.FlaxSeq2SeqModelOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_flax_outputs.FlaxSeq2SeqModelOutput</name><anchor>transformers.modeling_flax_outputs.FlaxSeq2SeqModelOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_flax_outputs.py#L263</source><parameters>[{"name": "last_hidden_state", "val": ": typing.Optional[jax.Array] = None"}, {"name": "past_key_values", "val": ": typing.Optional[tuple[tuple[jax.Array]]] = None"}, {"name": "decoder_hidden_states", "val": ": typing.Optional[tuple[jax.Array]] = None"}, {"name": "decoder_attentions", "val": ": typing.Optional[tuple[jax.Array]] = None"}, {"name": "cross_attentions", "val": ": typing.Optional[tuple[jax.Array]] = None"}, {"name": "encoder_last_hidden_state", "val": ": typing.Optional[jax.Array] = None"}, {"name": "encoder_hidden_states", "val": ": typing.Optional[tuple[jax.Array]] = None"}, {"name": "encoder_attentions", "val": ": typing.Optional[tuple[jax.Array]] = None"}]</parameters><paramsdesc>- **last_hidden_state** (`jnp.ndarray` of shape `(batch_size, sequence_length, hidden_size)`) --
  Sequence of hidden-states at the output of the last layer of the decoder of the model.

  If `past_key_values` is used only the last hidden-state of the sequences of shape `(batch_size, 1,
  hidden_size)` is output.
- **past_key_values** (`tuple(tuple(jnp.ndarray))`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`) --
  Tuple of `tuple(jnp.ndarray)` of length `config.n_layers`, with each tuple having 2 tensors of shape
  `(batch_size, num_heads, sequence_length, embed_size_per_head)`) and 2 additional tensors of shape
  `(batch_size, num_heads, encoder_sequence_length, embed_size_per_head)`.

  Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
  blocks) that can be used (see `past_key_values` input) to speed up sequential decoding.
- **decoder_hidden_states** (`tuple(jnp.ndarray)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `jnp.ndarray` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the decoder at the output of each layer plus the initial embedding outputs.
- **decoder_attentions** (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `jnp.ndarray` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the decoder, after the attention softmax, used to compute the weighted average in the
  self-attention heads.
- **cross_attentions** (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `jnp.ndarray` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the
  weighted average in the cross-attention heads.
- **encoder_last_hidden_state** (`jnp.ndarray` of shape `(batch_size, sequence_length, hidden_size)`, *optional*) --
  Sequence of hidden-states at the output of the last layer of the encoder of the model.
- **encoder_hidden_states** (`tuple(jnp.ndarray)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `jnp.ndarray` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the encoder at the output of each layer plus the initial embedding outputs.
- **encoder_attentions** (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `jnp.ndarray` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the encoder, after the attention softmax, used to compute the weighted average in the
  self-attention heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for model encoder's outputs that also contains : pre-computed hidden states that can speed up sequential
decoding.





<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>replace</name><anchor>transformers.modeling_flax_outputs.FlaxSeq2SeqModelOutput.replace</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/flax/struct.py#L111</source><parameters>[{"name": "**updates", "val": ""}]</parameters></docstring>
"Returns a new object replacing the specified fields with new values.

</div></div>

## FlaxCausalLMOutputWithCrossAttentions[[transformers.modeling_flax_outputs.FlaxCausalLMOutputWithCrossAttentions]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_flax_outputs.FlaxCausalLMOutputWithCrossAttentions</name><anchor>transformers.modeling_flax_outputs.FlaxCausalLMOutputWithCrossAttentions</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_flax_outputs.py#L324</source><parameters>[{"name": "logits", "val": ": typing.Optional[jax.Array] = None"}, {"name": "past_key_values", "val": ": typing.Optional[tuple[tuple[jax.Array]]] = None"}, {"name": "hidden_states", "val": ": typing.Optional[tuple[jax.Array]] = None"}, {"name": "attentions", "val": ": typing.Optional[tuple[jax.Array]] = None"}, {"name": "cross_attentions", "val": ": typing.Optional[tuple[jax.Array]] = None"}]</parameters><paramsdesc>- **logits** (`jnp.ndarray` of shape `(batch_size, sequence_length, config.vocab_size)`) --
  Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).
- **hidden_states** (`tuple(jnp.ndarray)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `jnp.ndarray` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the initial embedding outputs.
- **attentions** (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `jnp.ndarray` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.
- **cross_attentions** (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `jnp.ndarray` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Cross attentions weights after the attention softmax, used to compute the weighted average in the
  cross-attention heads.
- **past_key_values** (`tuple(tuple(jnp.ndarray))`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`) --
  Tuple of `jnp.ndarray` tuples of length `config.n_layers`, with each tuple containing the cached key, value
  states of the self-attention and the cross-attention layers if model is used in encoder-decoder setting.
  Only relevant if `config.is_decoder = True`.

  Contains pre-computed hidden-states (key and values in the attention blocks) that can be used (see
  `past_key_values` input) to speed up sequential decoding.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for causal language model (or autoregressive) outputs.





<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>replace</name><anchor>transformers.modeling_flax_outputs.FlaxCausalLMOutputWithCrossAttentions.replace</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/flax/struct.py#L111</source><parameters>[{"name": "**updates", "val": ""}]</parameters></docstring>
"Returns a new object replacing the specified fields with new values.

</div></div>

## FlaxMaskedLMOutput[[transformers.modeling_flax_outputs.FlaxMaskedLMOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_flax_outputs.FlaxMaskedLMOutput</name><anchor>transformers.modeling_flax_outputs.FlaxMaskedLMOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_flax_outputs.py#L365</source><parameters>[{"name": "logits", "val": ": typing.Optional[jax.Array] = None"}, {"name": "hidden_states", "val": ": typing.Optional[tuple[jax.Array]] = None"}, {"name": "attentions", "val": ": typing.Optional[tuple[jax.Array]] = None"}]</parameters><paramsdesc>- **logits** (`jnp.ndarray` of shape `(batch_size, sequence_length, config.vocab_size)`) --
  Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).
- **hidden_states** (`tuple(jnp.ndarray)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `jnp.ndarray` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the initial embedding outputs.
- **attentions** (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `jnp.ndarray` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for masked language models outputs.





<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>replace</name><anchor>transformers.modeling_flax_outputs.FlaxMaskedLMOutput.replace</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/flax/struct.py#L111</source><parameters>[{"name": "**updates", "val": ""}]</parameters></docstring>
"Returns a new object replacing the specified fields with new values.

</div></div>

## FlaxSeq2SeqLMOutput[[transformers.modeling_flax_outputs.FlaxSeq2SeqLMOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_flax_outputs.FlaxSeq2SeqLMOutput</name><anchor>transformers.modeling_flax_outputs.FlaxSeq2SeqLMOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_flax_outputs.py#L394</source><parameters>[{"name": "logits", "val": ": typing.Optional[jax.Array] = None"}, {"name": "past_key_values", "val": ": typing.Optional[tuple[tuple[jax.Array]]] = None"}, {"name": "decoder_hidden_states", "val": ": typing.Optional[tuple[jax.Array]] = None"}, {"name": "decoder_attentions", "val": ": typing.Optional[tuple[jax.Array]] = None"}, {"name": "cross_attentions", "val": ": typing.Optional[tuple[jax.Array]] = None"}, {"name": "encoder_last_hidden_state", "val": ": typing.Optional[jax.Array] = None"}, {"name": "encoder_hidden_states", "val": ": typing.Optional[tuple[jax.Array]] = None"}, {"name": "encoder_attentions", "val": ": typing.Optional[tuple[jax.Array]] = None"}]</parameters><paramsdesc>- **logits** (`jnp.ndarray` of shape `(batch_size, sequence_length, config.vocab_size)`) --
  Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).
- **past_key_values** (`tuple(tuple(jnp.ndarray))`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`) --
  Tuple of `tuple(jnp.ndarray)` of length `config.n_layers`, with each tuple having 2 tensors of shape
  `(batch_size, num_heads, sequence_length, embed_size_per_head)`) and 2 additional tensors of shape
  `(batch_size, num_heads, encoder_sequence_length, embed_size_per_head)`.

  Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
  blocks) that can be used (see `past_key_values` input) to speed up sequential decoding.
- **decoder_hidden_states** (`tuple(jnp.ndarray)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `jnp.ndarray` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the decoder at the output of each layer plus the initial embedding outputs.
- **decoder_attentions** (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `jnp.ndarray` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the decoder, after the attention softmax, used to compute the weighted average in the
  self-attention heads.
- **cross_attentions** (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `jnp.ndarray` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the
  weighted average in the cross-attention heads.
- **encoder_last_hidden_state** (`jnp.ndarray` of shape `(batch_size, sequence_length, hidden_size)`, *optional*) --
  Sequence of hidden-states at the output of the last layer of the encoder of the model.
- **encoder_hidden_states** (`tuple(jnp.ndarray)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `jnp.ndarray` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the encoder at the output of each layer plus the initial embedding outputs.
- **encoder_attentions** (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `jnp.ndarray` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the encoder, after the attention softmax, used to compute the weighted average in the
  self-attention heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for sequence-to-sequence language models outputs.





<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>replace</name><anchor>transformers.modeling_flax_outputs.FlaxSeq2SeqLMOutput.replace</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/flax/struct.py#L111</source><parameters>[{"name": "**updates", "val": ""}]</parameters></docstring>
"Returns a new object replacing the specified fields with new values.

</div></div>

## FlaxNextSentencePredictorOutput[[transformers.modeling_flax_outputs.FlaxNextSentencePredictorOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_flax_outputs.FlaxNextSentencePredictorOutput</name><anchor>transformers.modeling_flax_outputs.FlaxNextSentencePredictorOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_flax_outputs.py#L451</source><parameters>[{"name": "logits", "val": ": typing.Optional[jax.Array] = None"}, {"name": "hidden_states", "val": ": typing.Optional[tuple[jax.Array]] = None"}, {"name": "attentions", "val": ": typing.Optional[tuple[jax.Array]] = None"}]</parameters><paramsdesc>- **logits** (`jnp.ndarray` of shape `(batch_size, 2)`) --
  Prediction scores of the next sequence prediction (classification) head (scores of True/False continuation
  before SoftMax).
- **hidden_states** (`tuple(jnp.ndarray)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `jnp.ndarray` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the initial embedding outputs.
- **attentions** (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `jnp.ndarray` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for outputs of models predicting if two sentences are consecutive or not.





<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>replace</name><anchor>transformers.modeling_flax_outputs.FlaxNextSentencePredictorOutput.replace</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/flax/struct.py#L111</source><parameters>[{"name": "**updates", "val": ""}]</parameters></docstring>
"Returns a new object replacing the specified fields with new values.

</div></div>

## FlaxSequenceClassifierOutput[[transformers.modeling_flax_outputs.FlaxSequenceClassifierOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_flax_outputs.FlaxSequenceClassifierOutput</name><anchor>transformers.modeling_flax_outputs.FlaxSequenceClassifierOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_flax_outputs.py#L478</source><parameters>[{"name": "logits", "val": ": typing.Optional[jax.Array] = None"}, {"name": "hidden_states", "val": ": typing.Optional[tuple[jax.Array]] = None"}, {"name": "attentions", "val": ": typing.Optional[tuple[jax.Array]] = None"}]</parameters><paramsdesc>- **logits** (`jnp.ndarray` of shape `(batch_size, config.num_labels)`) --
  Classification (or regression if config.num_labels==1) scores (before SoftMax).
- **hidden_states** (`tuple(jnp.ndarray)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `jnp.ndarray` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the initial embedding outputs.
- **attentions** (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `jnp.ndarray` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for outputs of sentence classification models.





<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>replace</name><anchor>transformers.modeling_flax_outputs.FlaxSequenceClassifierOutput.replace</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/flax/struct.py#L111</source><parameters>[{"name": "**updates", "val": ""}]</parameters></docstring>
"Returns a new object replacing the specified fields with new values.

</div></div>

## FlaxSeq2SeqSequenceClassifierOutput[[transformers.modeling_flax_outputs.FlaxSeq2SeqSequenceClassifierOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_flax_outputs.FlaxSeq2SeqSequenceClassifierOutput</name><anchor>transformers.modeling_flax_outputs.FlaxSeq2SeqSequenceClassifierOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_flax_outputs.py#L504</source><parameters>[{"name": "logits", "val": ": typing.Optional[jax.Array] = None"}, {"name": "past_key_values", "val": ": typing.Optional[tuple[tuple[jax.Array]]] = None"}, {"name": "decoder_hidden_states", "val": ": typing.Optional[tuple[jax.Array]] = None"}, {"name": "decoder_attentions", "val": ": typing.Optional[tuple[jax.Array]] = None"}, {"name": "cross_attentions", "val": ": typing.Optional[tuple[jax.Array]] = None"}, {"name": "encoder_last_hidden_state", "val": ": typing.Optional[jax.Array] = None"}, {"name": "encoder_hidden_states", "val": ": typing.Optional[tuple[jax.Array]] = None"}, {"name": "encoder_attentions", "val": ": typing.Optional[tuple[jax.Array]] = None"}]</parameters><paramsdesc>- **logits** (`jnp.ndarray` of shape `(batch_size, config.num_labels)`) --
  Classification (or regression if config.num_labels==1) scores (before SoftMax).
- **past_key_values** (`tuple(tuple(jnp.ndarray))`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`) --
  Tuple of `tuple(jnp.ndarray)` of length `config.n_layers`, with each tuple having 2 tensors of shape
  `(batch_size, num_heads, sequence_length, embed_size_per_head)`) and 2 additional tensors of shape
  `(batch_size, num_heads, encoder_sequence_length, embed_size_per_head)`.

  Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
  blocks) that can be used (see `past_key_values` input) to speed up sequential decoding.
- **decoder_hidden_states** (`tuple(jnp.ndarray)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `jnp.ndarray` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the decoder at the output of each layer plus the initial embedding outputs.
- **decoder_attentions** (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `jnp.ndarray` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the decoder, after the attention softmax, used to compute the weighted average in the
  self-attention heads.
- **cross_attentions** (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `jnp.ndarray` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the
  weighted average in the cross-attention heads.
- **encoder_last_hidden_state** (`jnp.ndarray` of shape `(batch_size, sequence_length, hidden_size)`, *optional*) --
  Sequence of hidden-states at the output of the last layer of the encoder of the model.
- **encoder_hidden_states** (`tuple(jnp.ndarray)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `jnp.ndarray` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the encoder at the output of each layer plus the initial embedding outputs.
- **encoder_attentions** (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `jnp.ndarray` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the encoder, after the attention softmax, used to compute the weighted average in the
  self-attention heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for outputs of sequence-to-sequence sentence classification models.





<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>replace</name><anchor>transformers.modeling_flax_outputs.FlaxSeq2SeqSequenceClassifierOutput.replace</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/flax/struct.py#L111</source><parameters>[{"name": "**updates", "val": ""}]</parameters></docstring>
"Returns a new object replacing the specified fields with new values.

</div></div>

## FlaxMultipleChoiceModelOutput[[transformers.modeling_flax_outputs.FlaxMultipleChoiceModelOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_flax_outputs.FlaxMultipleChoiceModelOutput</name><anchor>transformers.modeling_flax_outputs.FlaxMultipleChoiceModelOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_flax_outputs.py#L561</source><parameters>[{"name": "logits", "val": ": typing.Optional[jax.Array] = None"}, {"name": "hidden_states", "val": ": typing.Optional[tuple[jax.Array]] = None"}, {"name": "attentions", "val": ": typing.Optional[tuple[jax.Array]] = None"}]</parameters><paramsdesc>- **logits** (`jnp.ndarray` of shape `(batch_size, num_choices)`) --
  *num_choices* is the second dimension of the input tensors. (see *input_ids* above).

  Classification scores (before SoftMax).
- **hidden_states** (`tuple(jnp.ndarray)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `jnp.ndarray` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the initial embedding outputs.
- **attentions** (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `jnp.ndarray` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for outputs of multiple choice models.





<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>replace</name><anchor>transformers.modeling_flax_outputs.FlaxMultipleChoiceModelOutput.replace</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/flax/struct.py#L111</source><parameters>[{"name": "**updates", "val": ""}]</parameters></docstring>
"Returns a new object replacing the specified fields with new values.

</div></div>

## FlaxTokenClassifierOutput[[transformers.modeling_flax_outputs.FlaxTokenClassifierOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_flax_outputs.FlaxTokenClassifierOutput</name><anchor>transformers.modeling_flax_outputs.FlaxTokenClassifierOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_flax_outputs.py#L589</source><parameters>[{"name": "logits", "val": ": typing.Optional[jax.Array] = None"}, {"name": "hidden_states", "val": ": typing.Optional[tuple[jax.Array]] = None"}, {"name": "attentions", "val": ": typing.Optional[tuple[jax.Array]] = None"}]</parameters><paramsdesc>- **logits** (`jnp.ndarray` of shape `(batch_size, sequence_length, config.num_labels)`) --
  Classification scores (before SoftMax).
- **hidden_states** (`tuple(jnp.ndarray)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `jnp.ndarray` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the initial embedding outputs.
- **attentions** (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `jnp.ndarray` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for outputs of token classification models.





<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>replace</name><anchor>transformers.modeling_flax_outputs.FlaxTokenClassifierOutput.replace</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/flax/struct.py#L111</source><parameters>[{"name": "**updates", "val": ""}]</parameters></docstring>
"Returns a new object replacing the specified fields with new values.

</div></div>

## FlaxQuestionAnsweringModelOutput[[transformers.modeling_flax_outputs.FlaxQuestionAnsweringModelOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_flax_outputs.FlaxQuestionAnsweringModelOutput</name><anchor>transformers.modeling_flax_outputs.FlaxQuestionAnsweringModelOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_flax_outputs.py#L615</source><parameters>[{"name": "start_logits", "val": ": typing.Optional[jax.Array] = None"}, {"name": "end_logits", "val": ": typing.Optional[jax.Array] = None"}, {"name": "hidden_states", "val": ": typing.Optional[tuple[jax.Array]] = None"}, {"name": "attentions", "val": ": typing.Optional[tuple[jax.Array]] = None"}]</parameters><paramsdesc>- **start_logits** (`jnp.ndarray` of shape `(batch_size, sequence_length)`) --
  Span-start scores (before SoftMax).
- **end_logits** (`jnp.ndarray` of shape `(batch_size, sequence_length)`) --
  Span-end scores (before SoftMax).
- **hidden_states** (`tuple(jnp.ndarray)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `jnp.ndarray` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the model at the output of each layer plus the initial embedding outputs.
- **attentions** (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `jnp.ndarray` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
  heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for outputs of question answering models.





<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>replace</name><anchor>transformers.modeling_flax_outputs.FlaxQuestionAnsweringModelOutput.replace</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/flax/struct.py#L111</source><parameters>[{"name": "**updates", "val": ""}]</parameters></docstring>
"Returns a new object replacing the specified fields with new values.

</div></div>

## FlaxSeq2SeqQuestionAnsweringModelOutput[[transformers.modeling_flax_outputs.FlaxSeq2SeqQuestionAnsweringModelOutput]]

<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>class transformers.modeling_flax_outputs.FlaxSeq2SeqQuestionAnsweringModelOutput</name><anchor>transformers.modeling_flax_outputs.FlaxSeq2SeqQuestionAnsweringModelOutput</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/transformers/modeling_flax_outputs.py#L644</source><parameters>[{"name": "start_logits", "val": ": typing.Optional[jax.Array] = None"}, {"name": "end_logits", "val": ": typing.Optional[jax.Array] = None"}, {"name": "past_key_values", "val": ": typing.Optional[tuple[tuple[jax.Array]]] = None"}, {"name": "decoder_hidden_states", "val": ": typing.Optional[tuple[jax.Array]] = None"}, {"name": "decoder_attentions", "val": ": typing.Optional[tuple[jax.Array]] = None"}, {"name": "cross_attentions", "val": ": typing.Optional[tuple[jax.Array]] = None"}, {"name": "encoder_last_hidden_state", "val": ": typing.Optional[jax.Array] = None"}, {"name": "encoder_hidden_states", "val": ": typing.Optional[tuple[jax.Array]] = None"}, {"name": "encoder_attentions", "val": ": typing.Optional[tuple[jax.Array]] = None"}]</parameters><paramsdesc>- **start_logits** (`jnp.ndarray` of shape `(batch_size, sequence_length)`) --
  Span-start scores (before SoftMax).
- **end_logits** (`jnp.ndarray` of shape `(batch_size, sequence_length)`) --
  Span-end scores (before SoftMax).
- **past_key_values** (`tuple(tuple(jnp.ndarray))`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`) --
  Tuple of `tuple(jnp.ndarray)` of length `config.n_layers`, with each tuple having 2 tensors of shape
  `(batch_size, num_heads, sequence_length, embed_size_per_head)`) and 2 additional tensors of shape
  `(batch_size, num_heads, encoder_sequence_length, embed_size_per_head)`.

  Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
  blocks) that can be used (see `past_key_values` input) to speed up sequential decoding.
- **decoder_hidden_states** (`tuple(jnp.ndarray)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `jnp.ndarray` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the decoder at the output of each layer plus the initial embedding outputs.
- **decoder_attentions** (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `jnp.ndarray` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the decoder, after the attention softmax, used to compute the weighted average in the
  self-attention heads.
- **cross_attentions** (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `jnp.ndarray` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the
  weighted average in the cross-attention heads.
- **encoder_last_hidden_state** (`jnp.ndarray` of shape `(batch_size, sequence_length, hidden_size)`, *optional*) --
  Sequence of hidden-states at the output of the last layer of the encoder of the model.
- **encoder_hidden_states** (`tuple(jnp.ndarray)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`) --
  Tuple of `jnp.ndarray` (one for the output of the embeddings + one for the output of each layer) of shape
  `(batch_size, sequence_length, hidden_size)`.

  Hidden-states of the encoder at the output of each layer plus the initial embedding outputs.
- **encoder_attentions** (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`) --
  Tuple of `jnp.ndarray` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
  sequence_length)`.

  Attentions weights of the encoder, after the attention softmax, used to compute the weighted average in the
  self-attention heads.</paramsdesc><paramgroups>0</paramgroups></docstring>

Base class for outputs of sequence-to-sequence question answering models.





<div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8">


<docstring><name>replace</name><anchor>transformers.modeling_flax_outputs.FlaxSeq2SeqQuestionAnsweringModelOutput.replace</anchor><source>https://github.com/huggingface/transformers/blob/v4.57.0/src/flax/struct.py#L111</source><parameters>[{"name": "**updates", "val": ""}]</parameters></docstring>
"Returns a new object replacing the specified fields with new values.

</div></div>

<EditOnGithub source="https://github.com/huggingface/transformers/blob/main/docs/source/zh/main_classes/output.md" />