Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
0d168cf6
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看板
提交
0d168cf6
编写于
1月 31, 2019
作者:
S
sneaxiy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test=release/1.3
上级
74bc55c2
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
8 addition
and
10 deletion
+8
-10
paddle/fluid/operators/norm_op.h
paddle/fluid/operators/norm_op.h
+2
-3
python/paddle/fluid/tests/unittests/test_eager_deletion_transformer.py
.../fluid/tests/unittests/test_eager_deletion_transformer.py
+3
-5
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/transformer_model.py
python/paddle/fluid/tests/unittests/transformer_model.py
+2
-1
未找到文件。
paddle/fluid/operators/norm_op.h
浏览文件 @
0d168cf6
...
@@ -99,10 +99,10 @@ class NormGradKernel : public framework::OpKernel<T> {
...
@@ -99,10 +99,10 @@ class NormGradKernel : public framework::OpKernel<T> {
auto
dx_e
=
framework
::
EigenVector
<
T
>::
Flatten
(
*
out_dx
);
auto
dx_e
=
framework
::
EigenVector
<
T
>::
Flatten
(
*
out_dx
);
Eigen
::
DSizes
<
int
,
3
>
shape
(
pre
,
n
,
post
);
Eigen
::
DSizes
<
int
,
3
>
shape
(
pre
,
n
,
post
);
Eigen
::
DSizes
<
int
,
2
>
norm_shape
(
pre
,
post
);
Eigen
::
DSizes
<
int
,
3
>
rshape
(
pre
,
1
,
post
);
auto
x
=
x_e
.
reshape
(
shape
);
auto
x
=
x_e
.
reshape
(
shape
);
auto
dy
=
dy_e
.
reshape
(
shape
);
auto
dy
=
dy_e
.
reshape
(
shape
);
auto
norm
=
norm_e
.
reshape
(
norm_
shape
);
auto
norm
=
norm_e
.
reshape
(
r
shape
);
auto
dx
=
dx_e
.
reshape
(
shape
);
auto
dx
=
dx_e
.
reshape
(
shape
);
framework
::
Tensor
rsum
;
framework
::
Tensor
rsum
;
...
@@ -111,7 +111,6 @@ class NormGradKernel : public framework::OpKernel<T> {
...
@@ -111,7 +111,6 @@ class NormGradKernel : public framework::OpKernel<T> {
Eigen
::
DSizes
<
int
,
1
>
rdim
(
1
);
Eigen
::
DSizes
<
int
,
1
>
rdim
(
1
);
Eigen
::
DSizes
<
int
,
3
>
bcast
(
1
,
n
,
1
);
Eigen
::
DSizes
<
int
,
3
>
bcast
(
1
,
n
,
1
);
Eigen
::
DSizes
<
int
,
3
>
rshape
(
pre
,
1
,
post
);
// dx = ( dy/sqrt(sum(x*x)) ) * [1 - x*sum(x) / (sum(x*x) + e)]
// dx = ( dy/sqrt(sum(x*x)) ) * [1 - x*sum(x) / (sum(x*x) + e)]
// = [dy - dy * x * sum(x) / (sum(x*x) + e)] / sqrt(sum(x*x))
// = [dy - dy * x * sum(x) / (sum(x*x) + e)] / sqrt(sum(x*x))
...
...
python/paddle/fluid/tests/unittests/test_eager_deletion_transformer.py
浏览文件 @
0d168cf6
...
@@ -16,12 +16,10 @@ import os
...
@@ -16,12 +16,10 @@ import os
import
unittest
import
unittest
os
.
environ
[
'FLAGS_eager_delete_tensor_gb'
]
=
"0.0"
os
.
environ
[
'FLAGS_eager_delete_tensor_gb'
]
=
"0.0"
from
test_parallel_executor_transformer
import
TestTransformer
os
.
environ
[
'RECORDIO_FILENAME'
]
=
'/tmp/eager_deletion_transformer.wmt16.recordio'
class
EagerDeletionTestTransformer
(
TestTransformer
):
pass
from
test_parallel_executor_transformer
import
TestTransformer
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
unittest
.
main
()
unittest
.
main
()
python/paddle/fluid/tests/unittests/test_parallel_executor_transformer.py
浏览文件 @
0d168cf6
...
@@ -24,7 +24,7 @@ import paddle.fluid.core as core
...
@@ -24,7 +24,7 @@ import paddle.fluid.core as core
import
paddle.dataset.wmt16
as
wmt16
import
paddle.dataset.wmt16
as
wmt16
import
os
import
os
WMT16_RECORDIO_FILE
=
"/tmp/wmt16.recordio"
WMT16_RECORDIO_FILE
=
os
.
environ
.
get
(
'RECORDIO_FILENAME'
,
'/tmp/wmt16.recordio'
)
class
ModelHyperParams
(
object
):
class
ModelHyperParams
(
object
):
...
...
python/paddle/fluid/tests/unittests/transformer_model.py
浏览文件 @
0d168cf6
...
@@ -17,6 +17,7 @@ from __future__ import print_function
...
@@ -17,6 +17,7 @@ from __future__ import print_function
from
functools
import
partial
from
functools
import
partial
import
numpy
as
np
import
numpy
as
np
import
os
import
paddle.fluid
as
fluid
import
paddle.fluid
as
fluid
import
paddle.fluid.layers
as
layers
import
paddle.fluid.layers
as
layers
from
paddle.fluid.layers.io
import
open_recordio_file
from
paddle.fluid.layers.io
import
open_recordio_file
...
@@ -408,7 +409,7 @@ def transformer(
...
@@ -408,7 +409,7 @@ def transformer(
trg_pad_idx
,
trg_pad_idx
,
pos_pad_idx
,
):
pos_pad_idx
,
):
file_obj
=
open_recordio_file
(
file_obj
=
open_recordio_file
(
filename
=
'/tmp/wmt16.recordio'
,
filename
=
os
.
environ
.
get
(
'RECORDIO_FILENAME'
,
'/tmp/wmt16.recordio'
)
,
shapes
=
[
shapes
=
[
[
batch_size
*
max_length
,
1
],
[
batch_size
*
max_length
,
1
],
[
batch_size
*
max_length
,
1
],
[
batch_size
*
max_length
,
1
],
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录