Merge pull request #1876 from huggingface/mean-fix

Mean does not exist in TF2
This commit is contained in:
Thomas Wolf
2019-11-29 09:26:33 +01:00
committed by GitHub

View File

@@ -460,7 +460,7 @@ class TFSequenceSummary(tf.keras.layers.Layer):
elif self.summary_type == 'first':
output = hidden_states[:, 0]
elif self.summary_type == 'mean':
output = tf.mean(hidden_states, axis=1)
output = tf.reduce_mean(hidden_states, axis=1)
elif self.summary_type == 'cls_index':
hidden_shape = shape_list(hidden_states) # e.g. [batch, num choices, seq length, hidden dims]
if cls_index is None: