"...git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "980211a63a2a07057a97b1eb47b7b09d7eda2bcd"
Unverified Commit 64103fb6 authored by Julien Plu's avatar Julien Plu Committed by GitHub
Browse files

Fix TransfoXL (#9302)

parent d97d06d0
...@@ -501,8 +501,8 @@ class TFTransfoXLMainLayer(tf.keras.layers.Layer): ...@@ -501,8 +501,8 @@ class TFTransfoXLMainLayer(tf.keras.layers.Layer):
# There are `mlen + qlen` steps that can be cached into mems # There are `mlen + qlen` steps that can be cached into mems
new_mems = [] new_mems = []
end_idx = mlen + max(0, qlen) end_idx = mlen + tf.math.maximum(0, qlen)
beg_idx = max(0, end_idx - self.mem_len) beg_idx = tf.math.maximum(0, end_idx - tf.convert_to_tensor(self.mem_len))
for i in range(len(hids)): for i in range(len(hids)):
cat = tf.concat([mems[i], hids[i]], axis=0) cat = tf.concat([mems[i], hids[i]], axis=0)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment