Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
f26a1c90
P
PaddleDetection
项目概览
s920243400
/
PaddleDetection
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleDetection
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
f26a1c90
编写于
1月 31, 2019
作者:
S
sneaxiy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test=develop
上级
43a67a26
变更
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
浏览文件 @
f26a1c90
...
...
@@ -99,10 +99,10 @@ class NormGradKernel : public framework::OpKernel<T> {
auto
dx_e
=
framework
::
EigenVector
<
T
>::
Flatten
(
*
out_dx
);
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
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
);
framework
::
Tensor
rsum
;
...
...
@@ -111,7 +111,6 @@ class NormGradKernel : public framework::OpKernel<T> {
Eigen
::
DSizes
<
int
,
1
>
rdim
(
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)]
// = [dy - dy * x * sum(x) / (sum(x*x) + e)] / sqrt(sum(x*x))
...
...
python/paddle/fluid/tests/unittests/test_eager_deletion_transformer.py
浏览文件 @
f26a1c90
...
...
@@ -16,12 +16,10 @@ import os
import
unittest
os
.
environ
[
'FLAGS_eager_delete_tensor_gb'
]
=
"0.0"
from
test_parallel_executor_transformer
import
TestTransformer
class
EagerDeletionTestTransformer
(
TestTransformer
):
pass
os
.
environ
[
'RECORDIO_FILENAME'
]
=
'/tmp/eager_deletion_transformer.wmt16.recordio'
from
test_parallel_executor_transformer
import
TestTransformer
if
__name__
==
'__main__'
:
unittest
.
main
()
python/paddle/fluid/tests/unittests/test_parallel_executor_transformer.py
浏览文件 @
f26a1c90
...
...
@@ -24,7 +24,7 @@ import paddle.fluid.core as core
import
paddle.dataset.wmt16
as
wmt16
import
os
WMT16_RECORDIO_FILE
=
"/tmp/wmt16.recordio"
WMT16_RECORDIO_FILE
=
os
.
environ
.
get
(
'RECORDIO_FILENAME'
,
'/tmp/wmt16.recordio'
)
class
ModelHyperParams
(
object
):
...
...
python/paddle/fluid/tests/unittests/transformer_model.py
浏览文件 @
f26a1c90
...
...
@@ -17,6 +17,7 @@ from __future__ import print_function
from
functools
import
partial
import
numpy
as
np
import
os
import
paddle.fluid
as
fluid
import
paddle.fluid.layers
as
layers
from
paddle.fluid.layers.io
import
open_recordio_file
...
...
@@ -408,7 +409,7 @@ def transformer(
trg_pad_idx
,
pos_pad_idx
,
):
file_obj
=
open_recordio_file
(
filename
=
'/tmp/wmt16.recordio'
,
filename
=
os
.
environ
.
get
(
'RECORDIO_FILENAME'
,
'/tmp/wmt16.recordio'
)
,
shapes
=
[
[
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录