Fix add order (#9129)

This commit is contained in:
Julien Plu 2020-12-15 21:16:56 +01:00 committed by GitHub
parent 18ecd36f65
commit e771749777
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -623,9 +623,9 @@ class TFTransfoXLMainLayer(tf.keras.layers.Layer):
core_out = tf.transpose(core_out, perm=(1, 0, 2))
if inputs["output_hidden_states"]:
# Add last layer and transpose to library standard shape [bsz, len, hidden_dim]
hids.append(core_out)
# Transpose to library standard shape [bsz, len, hidden_dim] and add last layer
hids = tuple(tf.transpose(t, perm=(1, 0, 2)) for t in hids)
hids = hids + (core_out,)
else:
hids = None
if inputs["output_attentions"]: