The output class for backbones of attention based models. Args: 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
| 27 | |
| 28 | @dataclass |
| 29 | class AttentionBackboneModelOutput(BackboneModelOutput): |
| 30 | """The output class for backbones of attention based models. |
| 31 | |
| 32 | Args: |
| 33 | attentions (`tuple(torch.FloatTensor)`, *optional*, returned when |
| 34 | `output_attentions=True` is passed or when |
| 35 | `config.output_attentions=True`): |
| 36 | Tuple of `torch.FloatTensor` (one for each layer) of shape |
| 37 | `(batch_size, num_heads, sequence_length, sequence_length)`. |
| 38 | |
| 39 | Attentions weights after the attention softmax, used to compute the |
| 40 | weighted average in the self-attention heads. |
| 41 | cross_attentions (`tuple(torch.FloatTensor)`, *optional*, returned when |
| 42 | `output_attentions=True` and `config.add_cross_attention=True` is passed |
| 43 | or when `config.output_attentions=True`): |
| 44 | Tuple of `torch.FloatTensor` (one for each layer) of shape |
| 45 | `(batch_size, num_heads, sequence_length, sequence_length)`. |
| 46 | |
| 47 | Attentions weights of the decoder's cross-attention layer, after the |
| 48 | attention softmax, used to compute the weighted average in the |
| 49 | cross-attention heads. |
| 50 | past_key_values (`tuple(tuple(torch.FloatTensor))`, *optional*, returned |
| 51 | when `use_cache=True` is passed or when `config.use_cache=True`): |
| 52 | Tuple of `tuple(torch.FloatTensor)` of length `config.n_layers`, |
| 53 | with each tuple having 2 tensors of shape `(batch_size, num_heads, |
| 54 | sequence_length, embed_size_per_head)`) and optionally if |
| 55 | `config.is_encoder_decoder=True` 2 additional tensors of shape |
| 56 | `(batch_size, num_heads, encoder_sequence_length, |
| 57 | embed_size_per_head)`. |
| 58 | |
| 59 | Contains pre-computed hidden-states (key and values in the |
| 60 | self-attention blocks and optionally if |
| 61 | `config.is_encoder_decoder=True` in the cross-attention blocks) that |
| 62 | can be used (see `past_key_values` input) to speed up sequential |
| 63 | decoding. |
| 64 | """ |
| 65 | attentions: Tensor = None |
| 66 | past_key_values: Tensor = None |
| 67 | cross_attentions: Tensor = None |
| 68 | |
| 69 | |
| 70 | @dataclass |
no outgoing calls
no test coverage detected
searching dependent graphs…