src/transformers/models/gpt2/modeling_tf_gpt2.py/TFGPT2DoubleHeadsModel/serving_output
class TFGPT2DoubleHeadsModel:    def serving_output(self, output):
        pkv = tf.convert_to_tensor(output.past_key_values) if self.config.use_cache else None
        hs = tf.convert_to_tensor(output.hidden_states) if self.config.output_hidden_states else None
        attns = tf.convert_to_tensor(output.attentions) if self.config.output_attentions else None

        return TFGPT2DoubleHeadsModelOutput(
            logits=output.logits,
            mc_logits=output.mc_logits,
            past_key_values=pkv,
            hidden_states=hs,
            attentions=attns,
        )