Passing hidden states and attention

I was wondering when it makes sense to pass the hidden states and attentions and when not? The hidden states are anyway being calculated, no matter whether I pass them or not, right?

As seen here:

The outputs object is a SequenceClassifierOutput, as we can see in the documentation of that class below, it means it has an optional loss , a logits an optional hidden_states and an optional attentions attribute. Here we have the loss since we passed along labels , but we don’t have hidden_states and attentions because we didn’t pass output_hidden_states=True or output_attentions=True .

Source