Skip to content

Commit 4b3e5f2

Browse files
lingvo-botcopybara-github
authored andcommitted
Add type conversion for ROP
PiperOrigin-RevId: 644480423
1 parent 83c6c72 commit 4b3e5f2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lingvo/core/layers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3514,7 +3514,8 @@ def FProp(self, theta, inputs, position=None):
35143514
position = tf.range(seq_length, dtype=tf.float32)[tf.newaxis, :]
35153515
position = position[:, :, tf.newaxis, tf.newaxis]
35163516
timescale = timescale[tf.newaxis, tf.newaxis, tf.newaxis, :]
3517-
sinusoid_inp = position / timescale
3517+
3518+
sinusoid_inp = position / tf.cast(timescale, position.dtype)
35183519
sin = tf.sin(sinusoid_inp)
35193520
cos = tf.cos(sinusoid_inp)
35203521
first_half, second_half = tf.split(inputs, 2, axis=-1)

0 commit comments

Comments
 (0)