mirror of
https://github.com/ml-explore/mlx-examples.git
synced 2025-08-22 04:56:49 +08:00
nits
This commit is contained in:
parent
342fa4af66
commit
62842d218d
@ -32,6 +32,7 @@ def rotate_half(x: mx.array) -> mx.array:
|
|||||||
x2 = x[..., 1::2]
|
x2 = x[..., 1::2]
|
||||||
return mx.concatenate([-x2, x1], axis=-1)
|
return mx.concatenate([-x2, x1], axis=-1)
|
||||||
|
|
||||||
|
|
||||||
def apply_rotary_pos_emb(q: mx.array, k: mx.array, cos: mx.array, sin: mx.array, position_ids=None, unsqueeze_dim=1) -> Tuple[mx.array, mx.array]:
|
def apply_rotary_pos_emb(q: mx.array, k: mx.array, cos: mx.array, sin: mx.array, position_ids=None, unsqueeze_dim=1) -> Tuple[mx.array, mx.array]:
|
||||||
"""
|
"""
|
||||||
Applies Rotary Position Embedding to the query and key tensors.
|
Applies Rotary Position Embedding to the query and key tensors.
|
||||||
|
Loading…
Reference in New Issue
Block a user