data
BaseModelOutputWithPooling
extends
ModelOutputBaseModelOutputWithPooling(last_hidden_state: Tensor, pooler_output: Tensor, hidden_states: tuple[Tensor, ...] | None = None, attentions: tuple[Tensor, ...] | None = None)Backbone output + pooled representation (e.g. CLS).
Attributes
last_hidden_stateTensorPer-token / per-spatial-location output, shape
(B, T, H).pooler_outputTensorAggregated representation — typically the
[CLS] position
passed through tanh(Linear(H, H)) (BERT-style) or a learned
attention pool. Shape (B, H).hidden_states(tuple[Tensor, ...] or None, optional)Per-layer hidden states; populated when
output_hidden_states=True.attentions(tuple[Tensor, ...] or None, optional)Per-layer attention weights; populated when
output_attentions=True.Notes
Used by encoder LMs that ship a sentence-level pooling head out of
the box — BERT and friends. Downstream classifiers attach to
pooler_output rather than re-pooling the per-token sequence.
Examples
>>> model = AutoModel.from_pretrained("bert_base")
>>> out = model(input_ids)
>>> out.pooler_output.shape
(1, 768)