Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
6220b8b9
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
大约 1 年 前同步成功
通知
695
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
6220b8b9
编写于
4月 12, 2019
作者:
C
chengduo
提交者:
GitHub
4月 12, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[Speed] Make test_dyn_rnn faster (#16761)
* make test_dyn_rnn faster
上级
06809ebb
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
7 addition
and
7 deletion
+7
-7
python/paddle/fluid/tests/unittests/test_dyn_rnn.py
python/paddle/fluid/tests/unittests/test_dyn_rnn.py
+6
-6
python/paddle/fluid/tests/unittests/test_parallel_executor_transformer.py
...uid/tests/unittests/test_parallel_executor_transformer.py
+1
-1
未找到文件。
python/paddle/fluid/tests/unittests/test_dyn_rnn.py
浏览文件 @
6220b8b9
...
@@ -24,15 +24,15 @@ from paddle.fluid.layers.control_flow import max_sequence_len
...
@@ -24,15 +24,15 @@ from paddle.fluid.layers.control_flow import max_sequence_len
from
paddle.fluid.layers.control_flow
import
lod_tensor_to_array
from
paddle.fluid.layers.control_flow
import
lod_tensor_to_array
from
paddle.fluid.layers.control_flow
import
array_to_lod_tensor
from
paddle.fluid.layers.control_flow
import
array_to_lod_tensor
from
paddle.fluid.layers.control_flow
import
shrink_memory
from
paddle.fluid.layers.control_flow
import
shrink_memory
from
fake_reader
import
fake_imdb_reader
class
TestDynRNN
(
unittest
.
TestCase
):
class
TestDynRNN
(
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
word_dict
=
paddle
.
dataset
.
imdb
.
word_dict
()
self
.
word_dict
_len
=
5147
self
.
BATCH_SIZE
=
2
self
.
BATCH_SIZE
=
2
self
.
train_data
=
paddle
.
batch
(
reader
=
fake_imdb_reader
(
self
.
word_dict_len
,
self
.
BATCH_SIZE
*
100
)
paddle
.
dataset
.
imdb
.
train
(
self
.
word_dict
),
self
.
train_data
=
paddle
.
batch
(
reader
,
batch_size
=
self
.
BATCH_SIZE
)
batch_size
=
self
.
BATCH_SIZE
)
def
test_plain_while_op
(
self
):
def
test_plain_while_op
(
self
):
main_program
=
fluid
.
Program
()
main_program
=
fluid
.
Program
()
...
@@ -42,7 +42,7 @@ class TestDynRNN(unittest.TestCase):
...
@@ -42,7 +42,7 @@ class TestDynRNN(unittest.TestCase):
sentence
=
fluid
.
layers
.
data
(
sentence
=
fluid
.
layers
.
data
(
name
=
'word'
,
shape
=
[
1
],
dtype
=
'int64'
,
lod_level
=
1
)
name
=
'word'
,
shape
=
[
1
],
dtype
=
'int64'
,
lod_level
=
1
)
sent_emb
=
fluid
.
layers
.
embedding
(
sent_emb
=
fluid
.
layers
.
embedding
(
input
=
sentence
,
size
=
[
len
(
self
.
word_dict
)
,
32
],
dtype
=
'float32'
)
input
=
sentence
,
size
=
[
self
.
word_dict_len
,
32
],
dtype
=
'float32'
)
label
=
fluid
.
layers
.
data
(
name
=
'label'
,
shape
=
[
1
],
dtype
=
'float32'
)
label
=
fluid
.
layers
.
data
(
name
=
'label'
,
shape
=
[
1
],
dtype
=
'float32'
)
...
@@ -109,7 +109,7 @@ class TestDynRNN(unittest.TestCase):
...
@@ -109,7 +109,7 @@ class TestDynRNN(unittest.TestCase):
sentence
=
fluid
.
layers
.
data
(
sentence
=
fluid
.
layers
.
data
(
name
=
'word'
,
shape
=
[
1
],
dtype
=
'int64'
,
lod_level
=
1
)
name
=
'word'
,
shape
=
[
1
],
dtype
=
'int64'
,
lod_level
=
1
)
sent_emb
=
fluid
.
layers
.
embedding
(
sent_emb
=
fluid
.
layers
.
embedding
(
input
=
sentence
,
size
=
[
len
(
self
.
word_dict
)
,
32
],
dtype
=
'float32'
)
input
=
sentence
,
size
=
[
self
.
word_dict_len
,
32
],
dtype
=
'float32'
)
rnn
=
fluid
.
layers
.
DynamicRNN
()
rnn
=
fluid
.
layers
.
DynamicRNN
()
...
...
python/paddle/fluid/tests/unittests/test_parallel_executor_transformer.py
浏览文件 @
6220b8b9
...
@@ -175,7 +175,7 @@ class TestTransformer(TestParallelExecutorBase):
...
@@ -175,7 +175,7 @@ class TestTransformer(TestParallelExecutorBase):
self
.
check_network_convergence
(
transformer
,
use_cuda
=
True
)
self
.
check_network_convergence
(
transformer
,
use_cuda
=
True
)
self
.
check_network_convergence
(
self
.
check_network_convergence
(
transformer
,
use_cuda
=
True
,
enable_sequential_execution
=
True
)
transformer
,
use_cuda
=
True
,
enable_sequential_execution
=
True
)
self
.
check_network_convergence
(
transformer
,
use_cuda
=
False
,
iter
=
5
)
self
.
check_network_convergence
(
transformer
,
use_cuda
=
False
,
iter
=
2
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录