Skip to content

Commit 7054a25

Browse files
committed
Preload sin_table and cos_table in rope.py
1 parent fdbbe6e commit 7054a25

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

rope.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,14 @@ def arrangement(tensor, sin_table, cos_table, interleaved=True):
3131

3232

3333
def application(tensor, sin_table, cos_table):
34+
sin_table_loaded = sin_table
35+
cos_table_loaded = cos_table
36+
3437
tensor_0 = tensor[0]
3538
tensor_1 = tensor[1]
3639

37-
tensor[0] = tensor_0 * cos_table - tensor_1 * sin_table
38-
tensor[1] = tensor_0 * sin_table + tensor_1 * cos_table
40+
tensor[0] = tensor_0 * cos_table_loaded - tensor_1 * sin_table_loaded
41+
tensor[1] = tensor_0 * sin_table_loaded + tensor_1 * cos_table_loaded
3942

4043

4144
tensors = tuple(Tensor(4, shape_options={"constexpr": True}) for _ in range(3))

0 commit comments

Comments
 (0)