Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
d7668699
M
models
项目概览
PaddlePaddle
/
models
大约 1 年 前同步成功
通知
222
Star
6828
Fork
2962
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
602
列表
看板
标记
里程碑
合并请求
255
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
models
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
602
Issue
602
列表
看板
标记
里程碑
合并请求
255
合并请求
255
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
d7668699
编写于
12月 09, 2019
作者:
L
Leo Chen
提交者:
GitHub
12月 09, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polish usage of deprecated or private API in Dygraph (#4035)
上级
1fb663c5
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
8 addition
and
16 deletion
+8
-16
PaddleNLP/Research/Dialogue-PLATO/plato/modules/parallel.py
PaddleNLP/Research/Dialogue-PLATO/plato/modules/parallel.py
+2
-6
PaddleSpeech/DeepVoice3/deepvoice3_paddle/modules.py
PaddleSpeech/DeepVoice3/deepvoice3_paddle/modules.py
+1
-1
dygraph/ocr_recognition/train.py
dygraph/ocr_recognition/train.py
+2
-6
dygraph/resnet/train.py
dygraph/resnet/train.py
+2
-2
dygraph/se_resnext/train.py
dygraph/se_resnext/train.py
+1
-1
未找到文件。
PaddleNLP/Research/Dialogue-PLATO/plato/modules/parallel.py
浏览文件 @
d7668699
...
...
@@ -226,12 +226,8 @@ class DataParallel(layers.Layer):
grad_vars
=
[]
for
param
in
self
.
_layers
.
parameters
():
# NOTE(zcd): The grad_ivar maybe no generated.
if
param
.
trainable
and
param
.
_ivar
.
_grad_ivar
():
g_var
=
framework
.
Variable
(
block
=
self
.
_helper
.
main_program
.
current_block
(),
name
=
param
.
_ivar
.
_grad_name
(),
stop_gradient
=
True
,
ivar
=
param
.
_ivar
.
_grad_ivar
())
if
param
.
trainable
and
param
.
_grad_ivar
():
g_var
=
param
.
_grad_ivar
()
grad_vars
.
append
(
g_var
)
assert
g_var
not
in
grad_var_set
grad_var_set
.
add
(
g_var
)
...
...
PaddleSpeech/DeepVoice3/deepvoice3_paddle/modules.py
浏览文件 @
d7668699
...
...
@@ -367,7 +367,7 @@ class PositionEmbedding(dg.Layer):
def
set_weight
(
self
,
array
):
assert
self
.
embed
.
_w
.
shape
==
list
(
array
.
shape
),
"shape does not match"
self
.
embed
.
_w
.
_ivar
.
value
().
get_tensor
().
set
(
self
.
embed
.
_w
.
value
().
get_tensor
().
set
(
array
,
fluid
.
framework
.
_current_expected_place
())
def
forward
(
self
,
indices
,
speaker_position_rate
=
None
):
...
...
dygraph/ocr_recognition/train.py
浏览文件 @
d7668699
...
...
@@ -486,8 +486,7 @@ def train(args):
label_in
=
to_variable
(
data_dict
[
"label_in"
])
label_out
=
to_variable
(
data_dict
[
"label_out"
])
label_out
.
_stop_gradient
=
True
label_out
.
trainable
=
False
label_out
.
stop_gradient
=
True
img
=
to_variable
(
data_dict
[
"pixel"
])
...
...
@@ -528,8 +527,7 @@ def train(args):
label_in
=
to_variable
(
data_dict
[
"label_in"
])
label_out
=
to_variable
(
data_dict
[
"label_out"
])
label_out
.
_stop_gradient
=
True
label_out
.
trainable
=
False
label_out
.
stop_gradient
=
True
img
=
to_variable
(
data_dict
[
"pixel"
])
...
...
@@ -549,8 +547,6 @@ def train(args):
optimizer
.
minimize
(
avg_loss
,
grad_clip
=
grad_clip
)
ocr_attention
.
clear_gradients
()
framework
.
_dygraph_tracer
().
_clear_ops
()
if
batch_id
>
0
and
batch_id
%
1000
==
0
:
print
(
"epoch: {}, batch_id: {}, loss {}"
.
format
(
epoch
,
batch_id
,
total_loss
/
args
.
batch_size
/
1000
))
...
...
dygraph/resnet/train.py
浏览文件 @
d7668699
...
...
@@ -247,7 +247,7 @@ def eval(model, data):
img
=
to_variable
(
dy_x_data
)
label
=
to_variable
(
y_data
)
label
.
_
stop_gradient
=
True
label
.
stop_gradient
=
True
out
=
model
(
img
)
#loss = fluid.layers.cross_entropy(input=out, label=label)
...
...
@@ -335,7 +335,7 @@ def train_resnet():
img
=
to_variable
(
dy_x_data
)
label
=
to_variable
(
y_data
)
label
.
_
stop_gradient
=
True
label
.
stop_gradient
=
True
out
=
resnet
(
img
)
loss
=
fluid
.
layers
.
cross_entropy
(
input
=
out
,
label
=
label
)
...
...
dygraph/se_resnext/train.py
浏览文件 @
d7668699
...
...
@@ -336,7 +336,7 @@ def eval(model, data):
img
=
to_variable
(
dy_x_data
)
label
=
to_variable
(
y_data
)
label
.
_
stop_gradient
=
True
label
.
stop_gradient
=
True
out
=
model
(
img
)
softmax_out
=
fluid
.
layers
.
softmax
(
out
,
use_cudnn
=
False
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录