From 5ee084163e1843c9a1f1fef2dfe60d05ca586ecc Mon Sep 17 00:00:00 2001 From: kircle <945428667@qq.com> Date: Mon, 15 Apr 2024 19:52:16 +0800 Subject: [PATCH] add assertion --- .../nn/functional/fused_rotary_position_embedding.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/python/paddle/incubate/nn/functional/fused_rotary_position_embedding.py b/python/paddle/incubate/nn/functional/fused_rotary_position_embedding.py index e51a5b5c4e852..b94d37acd7b4d 100644 --- a/python/paddle/incubate/nn/functional/fused_rotary_position_embedding.py +++ b/python/paddle/incubate/nn/functional/fused_rotary_position_embedding.py @@ -91,6 +91,14 @@ def fused_rotary_position_embedding( [[ 0.07116699, -0.90966797], [-0.03628540, -0.20202637]]]]) """ + if (sin is None) or (cos is None): + assert ( + position_ids is None + ), "position_ids without sin/cos is not correctly supported now." + assert ( + use_neox_rotary_style + ), "rotate_half without sin/cos is not correctly supported now." + if in_dynamic_or_pir_mode(): return _C_ops.fused_rotary_position_embedding( q,