src/transformers/models/transfo_xl/modeling_tf_transfo_xl.py/TFTransfoXLLMHeadModel/serving_output
class TFTransfoXLLMHeadModel:    def serving_output(self, output):
        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 TFTransfoXLLMHeadModelOutput(
            prediction_scores=output.prediction_scores,
            mems=tf.convert_to_tensor(output.mems),
            hidden_states=hs,
            attentions=attns,
        )