Skip to content

Commit 116b888

Browse files
Update phishing_email_detection_gpt2.py
...
1 parent 432df19 commit 116b888

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

phishing_email_detection_gpt2.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,15 @@ def split_alternate(x):
252252
x = tf.reshape(x, [shape[0], shape[1], -1])
253253
return x
254254

255+
255256
def rotate_half(x):
256257
x = split_alternate(x)
257258
d = tf.shape(x)[-1]
258-
return x[..., d//2:]
259+
x1 = x[..., :d//2]
260+
x2 = x[..., d//2:]
261+
rotated_x = tf.concat([-x2, x1], axis=-1)
262+
return tf.reshape(rotated_x, tf.shape(x)[:-2] + [-1])
263+
259264

260265
def apply_rotary_pos_emb(x, sin, cos):
261266
cos = tf.reshape(cos, [tf.shape(cos)[0], tf.shape(cos)[1], -1])

0 commit comments

Comments
 (0)