Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
c9e1d9dc
P
Paddle
项目概览
机器未来
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
c9e1d9dc
编写于
3月 19, 2021
作者:
R
ronnywang
提交者:
GitHub
3月 19, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[ROCM] fix test_rnn_op (#31735)
上级
1c67cf0c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
29 addition
and
6 deletion
+29
-6
paddle/fluid/operators/rnn_op.cu.cc
paddle/fluid/operators/rnn_op.cu.cc
+4
-3
paddle/fluid/platform/dynload/miopen.h
paddle/fluid/platform/dynload/miopen.h
+1
-0
python/paddle/fluid/tests/unittests/test_rnn_op.py
python/paddle/fluid/tests/unittests/test_rnn_op.py
+24
-3
未找到文件。
paddle/fluid/operators/rnn_op.cu.cc
浏览文件 @
c9e1d9dc
...
...
@@ -117,10 +117,11 @@ class RNNDescriptors {
// ------------------- cudnn rnn descriptors ---------------------
#ifdef PADDLE_WITH_HIP
PADDLE_ENFORCE_CUDA_SUCCESS
(
platform
::
dynload
::
miopenSetRNNDescriptor
(
rnn_desc_
.
desc
(),
hidden_size_
,
num_layers_
,
miopenRNNlinear
,
PADDLE_ENFORCE_CUDA_SUCCESS
(
platform
::
dynload
::
miopenSetRNNDescriptor_V2
(
rnn_desc_
.
desc
(),
hidden_size_
,
num_layers_
,
dropout_desc_
.
desc
(),
miopenRNNlinear
,
is_bidirec_
?
miopenRNNbidirection
:
miopenRNNunidirection
,
mode_
,
miopenRNN
No
Bias
,
miopenRNNdefault
,
cudnn_type
));
miopenRNN
with
Bias
,
miopenRNNdefault
,
cudnn_type
));
#elif CUDNN_VERSION >= 6000
PADDLE_ENFORCE_CUDA_SUCCESS
(
platform
::
dynload
::
cudnnSetRNNDescriptor_v6
(
handle
,
rnn_desc_
.
desc
(),
hidden_size_
,
num_layers_
,
...
...
paddle/fluid/platform/dynload/miopen.h
浏览文件 @
c9e1d9dc
...
...
@@ -125,6 +125,7 @@ extern void EnforceCUDNNLoaded(const char* fn_name);
__macro(miopenCreateRNNDescriptor); \
__macro(miopenDestroyRNNDescriptor); \
__macro(miopenSetRNNDescriptor); \
__macro(miopenSetRNNDescriptor_V2); \
__macro(miopenGetRNNParamsSize); \
__macro(miopenGetRNNWorkspaceSize); \
__macro(miopenGetRNNTrainingReserveSize); \
...
...
python/paddle/fluid/tests/unittests/test_rnn_op.py
浏览文件 @
c9e1d9dc
...
...
@@ -47,8 +47,10 @@ class TestRNNOp(OpTest):
def
setUp
(
self
):
self
.
op_type
=
"rnn"
self
.
dtype
=
np
.
float64
self
.
sequence_length
=
np
.
array
([
12
,
11
,
10
,
9
,
8
],
dtype
=
np
.
int32
)
self
.
dtype
=
np
.
float32
if
core
.
is_compiled_with_rocm
()
else
np
.
float64
self
.
sequence_length
=
None
if
core
.
is_compiled_with_rocm
(
)
else
np
.
array
(
[
12
,
11
,
10
,
9
,
8
],
dtype
=
np
.
int32
)
self
.
num_layers
=
1
self
.
is_bidirec
=
False
self
.
mode
=
"LSTM"
...
...
@@ -78,12 +80,31 @@ class TestRNNOp(OpTest):
num_layers
=
self
.
num_layers
,
time_major
=
True
,
direction
=
direction
,
dropout
=
self
.
dropout
)
dropout
=
self
.
dropout
,
dtype
=
self
.
dtype
)
flat_w
=
get_params_for_net
(
rnn1
)
output
,
(
last_hidden
,
last_cell
)
=
rnn1
(
input
,
sequence_length
=
self
.
sequence_length
)
if
core
.
is_compiled_with_rocm
():
def
rocm_rnn_get_place
():
places
=
[
core
.
CUDAPlace
(
0
)]
return
places
self
.
_get_places
=
rocm_rnn_get_place
if
self
.
is_bidirec
:
for
i
in
range
(
0
,
len
(
flat_w
),
4
):
flat_w
[
i
+
1
],
flat_w
[
i
+
2
]
=
flat_w
[
i
+
2
],
flat_w
[
i
+
1
]
for
i
in
range
(
len
(
flat_w
)):
w
=
np
.
split
(
flat_w
[
i
][
1
],
4
,
0
)
w
=
[
w
[
0
],
w
[
1
],
w
[
3
],
w
[
2
]]
w
=
np
.
concatenate
(
w
)
flat_w
[
i
]
=
(
flat_w
[
i
][
0
],
w
)
init_h
=
np
.
zeros
((
self
.
num_layers
*
self
.
direction_num
,
batch_size
,
hidden_size
)).
astype
(
self
.
dtype
)
init_c
=
np
.
zeros
((
self
.
num_layers
*
self
.
direction_num
,
batch_size
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录