Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
9b317b2d
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2306
Star
20932
Fork
5423
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
9b317b2d
编写于
8月 09, 2023
作者:
N
niuliling123
提交者:
GitHub
8月 09, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add assert for static and other plateform (#56044)
上级
caa0f377
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
14 addition
and
1 deletion
+14
-1
python/paddle/incubate/nn/functional/fused_rotary_position_embedding.py
...incubate/nn/functional/fused_rotary_position_embedding.py
+5
-1
test/legacy_test/test_fused_rotary_position_embedding.py
test/legacy_test/test_fused_rotary_position_embedding.py
+9
-0
未找到文件。
python/paddle/incubate/nn/functional/fused_rotary_position_embedding.py
浏览文件 @
9b317b2d
...
...
@@ -17,7 +17,7 @@ from paddle import _C_ops
from
paddle.framework
import
in_dynamic_mode
def
fused_rotary_position_embedding
(
q
,
k
,
v
):
def
fused_rotary_position_embedding
(
q
,
k
=
None
,
v
=
None
):
r
"""
Fused rotary position embedding.
...
...
@@ -47,3 +47,7 @@ def fused_rotary_position_embedding(q, k, v):
"""
if
in_dynamic_mode
():
return
_C_ops
.
fused_rotary_position_embedding
(
q
,
k
,
v
)
raise
RuntimeError
(
"This feature is currently supported only in dynamic mode and with CUDAPlace."
)
test/legacy_test/test_fused_rotary_position_embedding.py
浏览文件 @
9b317b2d
...
...
@@ -139,6 +139,15 @@ class TestFusedRotaryPositionEmbedding(unittest.TestCase):
p_bw
[
i
].
numpy
(),
f_bw
[
i
].
numpy
(),
rtol
=
1e-05
)
def
test_error
(
self
):
paddle
.
enable_static
()
with
self
.
assertRaises
(
RuntimeError
):
static_q
=
paddle
.
static
.
data
(
name
=
"q"
,
shape
=
self
.
shape
,
dtype
=
self
.
dtype
)
fused_rotary_position_embedding
(
static_q
,
static_q
,
static_q
)
paddle
.
disable_static
()
if
__name__
==
'__main__'
:
unittest
.
main
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录