Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
d2939cab
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
d2939cab
编写于
4月 07, 2023
作者:
N
Nyakku Shigure
提交者:
GitHub
4月 07, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[Dy2St] fix train step random failed on Windows (#52580)
上级
a62de41a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
35 addition
and
1 deletion
+35
-1
test/dygraph_to_static/test_train_step.py
test/dygraph_to_static/test_train_step.py
+27
-1
test/dygraph_to_static/test_train_step_resnet18_adam.py
test/dygraph_to_static/test_train_step_resnet18_adam.py
+4
-0
test/dygraph_to_static/test_train_step_resnet18_sgd.py
test/dygraph_to_static/test_train_step_resnet18_sgd.py
+4
-0
未找到文件。
test/dygraph_to_static/test_train_step.py
浏览文件 @
d2939cab
...
...
@@ -58,6 +58,7 @@ class TestTrainStepTinyModel(unittest.TestCase):
self
.
loss_fn
=
loss_fn_tiny_model
self
.
train_step_func
=
train_step_tiny_model
self
.
steps
=
5
self
.
rtol
=
1e-4
def
get_train_step_losses
(
self
,
func
,
steps
):
losses
=
[]
...
...
@@ -87,7 +88,9 @@ class TestTrainStepTinyModel(unittest.TestCase):
for
dygraph_loss
,
static_loss
in
zip
(
dygraph_losses
,
static_losses
):
dygraph_loss
=
dygraph_loss
.
numpy
()
static_loss
=
static_loss
.
numpy
()
np
.
testing
.
assert_allclose
(
dygraph_loss
,
static_loss
,
rtol
=
1e-4
)
np
.
testing
.
assert_allclose
(
dygraph_loss
,
static_loss
,
rtol
=
self
.
rtol
)
class
TestTrainStepTinyModelAdadelta
(
TestTrainStepTinyModel
):
...
...
@@ -99,6 +102,7 @@ class TestTrainStepTinyModelAdadelta(TestTrainStepTinyModel):
self
.
loss_fn
=
loss_fn_tiny_model
self
.
train_step_func
=
train_step_tiny_model
self
.
steps
=
3
self
.
rtol
=
1e-4
class
TestTrainStepTinyModelAdagrad
(
TestTrainStepTinyModel
):
...
...
@@ -110,6 +114,7 @@ class TestTrainStepTinyModelAdagrad(TestTrainStepTinyModel):
self
.
loss_fn
=
loss_fn_tiny_model
self
.
train_step_func
=
train_step_tiny_model
self
.
steps
=
3
self
.
rtol
=
1e-4
class
TestTrainStepTinyModelAdam
(
TestTrainStepTinyModel
):
...
...
@@ -121,6 +126,7 @@ class TestTrainStepTinyModelAdam(TestTrainStepTinyModel):
self
.
loss_fn
=
loss_fn_tiny_model
self
.
train_step_func
=
train_step_tiny_model
self
.
steps
=
3
self
.
rtol
=
1e-4
class
TestTrainStepTinyModelAdamax
(
TestTrainStepTinyModel
):
...
...
@@ -132,6 +138,7 @@ class TestTrainStepTinyModelAdamax(TestTrainStepTinyModel):
self
.
loss_fn
=
loss_fn_tiny_model
self
.
train_step_func
=
train_step_tiny_model
self
.
steps
=
3
self
.
rtol
=
1e-4
class
TestTrainStepTinyModelAdamW
(
TestTrainStepTinyModel
):
...
...
@@ -143,6 +150,7 @@ class TestTrainStepTinyModelAdamW(TestTrainStepTinyModel):
self
.
loss_fn
=
loss_fn_tiny_model
self
.
train_step_func
=
train_step_tiny_model
self
.
steps
=
3
self
.
rtol
=
1e-4
class
TestTrainStepTinyModelLamb
(
TestTrainStepTinyModel
):
...
...
@@ -156,6 +164,7 @@ class TestTrainStepTinyModelLamb(TestTrainStepTinyModel):
self
.
loss_fn
=
loss_fn_tiny_model
self
.
train_step_func
=
train_step_tiny_model
self
.
steps
=
3
self
.
rtol
=
1e-4
class
TestTrainStepTinyModelMomentum
(
TestTrainStepTinyModel
):
...
...
@@ -167,6 +176,7 @@ class TestTrainStepTinyModelMomentum(TestTrainStepTinyModel):
self
.
loss_fn
=
loss_fn_tiny_model
self
.
train_step_func
=
train_step_tiny_model
self
.
steps
=
3
self
.
rtol
=
1e-4
class
TestTrainStepTinyModelRMSProp
(
TestTrainStepTinyModel
):
...
...
@@ -178,6 +188,7 @@ class TestTrainStepTinyModelRMSProp(TestTrainStepTinyModel):
self
.
loss_fn
=
loss_fn_tiny_model
self
.
train_step_func
=
train_step_tiny_model
self
.
steps
=
3
self
.
rtol
=
1e-4
class
TestTrainStepTinyModelLRNoamDecay
(
TestTrainStepTinyModel
):
...
...
@@ -191,6 +202,7 @@ class TestTrainStepTinyModelLRNoamDecay(TestTrainStepTinyModel):
self
.
loss_fn
=
loss_fn_tiny_model
self
.
train_step_func
=
train_step_tiny_model
self
.
steps
=
3
self
.
rtol
=
1e-4
class
TestTrainStepTinyModelLRPiecewiseDecay
(
TestTrainStepTinyModel
):
...
...
@@ -206,6 +218,7 @@ class TestTrainStepTinyModelLRPiecewiseDecay(TestTrainStepTinyModel):
self
.
loss_fn
=
loss_fn_tiny_model
self
.
train_step_func
=
train_step_tiny_model
self
.
steps
=
3
self
.
rtol
=
1e-4
class
TestTrainStepTinyModelLRNaturalExpDecay
(
TestTrainStepTinyModel
):
...
...
@@ -221,6 +234,7 @@ class TestTrainStepTinyModelLRNaturalExpDecay(TestTrainStepTinyModel):
self
.
loss_fn
=
loss_fn_tiny_model
self
.
train_step_func
=
train_step_tiny_model
self
.
steps
=
3
self
.
rtol
=
1e-4
class
TestTrainStepTinyModelLRInverseTimeDecay
(
TestTrainStepTinyModel
):
...
...
@@ -234,6 +248,7 @@ class TestTrainStepTinyModelLRInverseTimeDecay(TestTrainStepTinyModel):
self
.
loss_fn
=
loss_fn_tiny_model
self
.
train_step_func
=
train_step_tiny_model
self
.
steps
=
3
self
.
rtol
=
1e-4
class
TestTrainStepTinyModelLRPolynomialDecay
(
TestTrainStepTinyModel
):
...
...
@@ -250,6 +265,7 @@ class TestTrainStepTinyModelLRPolynomialDecay(TestTrainStepTinyModel):
self
.
loss_fn
=
loss_fn_tiny_model
self
.
train_step_func
=
train_step_tiny_model
self
.
steps
=
3
self
.
rtol
=
1e-4
class
TestTrainStepTinyModelLRLinearWarmup
(
TestTrainStepTinyModel
):
...
...
@@ -267,6 +283,7 @@ class TestTrainStepTinyModelLRLinearWarmup(TestTrainStepTinyModel):
self
.
loss_fn
=
loss_fn_tiny_model
self
.
train_step_func
=
train_step_tiny_model
self
.
steps
=
3
self
.
rtol
=
1e-4
class
TestTrainStepTinyModelLRExponentialDecay
(
TestTrainStepTinyModel
):
...
...
@@ -280,6 +297,7 @@ class TestTrainStepTinyModelLRExponentialDecay(TestTrainStepTinyModel):
self
.
loss_fn
=
loss_fn_tiny_model
self
.
train_step_func
=
train_step_tiny_model
self
.
steps
=
3
self
.
rtol
=
1e-4
class
TestTrainStepTinyModelLRMultiStepDecay
(
TestTrainStepTinyModel
):
...
...
@@ -297,6 +315,7 @@ class TestTrainStepTinyModelLRMultiStepDecay(TestTrainStepTinyModel):
self
.
loss_fn
=
loss_fn_tiny_model
self
.
train_step_func
=
train_step_tiny_model
self
.
steps
=
3
self
.
rtol
=
1e-4
class
TestTrainStepTinyModelLRStepDecay
(
TestTrainStepTinyModel
):
...
...
@@ -313,6 +332,7 @@ class TestTrainStepTinyModelLRStepDecay(TestTrainStepTinyModel):
self
.
loss_fn
=
loss_fn_tiny_model
self
.
train_step_func
=
train_step_tiny_model
self
.
steps
=
3
self
.
rtol
=
1e-4
class
TestTrainStepTinyModelLRLambdaDecay
(
TestTrainStepTinyModel
):
...
...
@@ -328,6 +348,7 @@ class TestTrainStepTinyModelLRLambdaDecay(TestTrainStepTinyModel):
self
.
loss_fn
=
loss_fn_tiny_model
self
.
train_step_func
=
train_step_tiny_model
self
.
steps
=
3
self
.
rtol
=
1e-4
class
TestTrainStepTinyModelLRReduceOnPlateau
(
TestTrainStepTinyModel
):
...
...
@@ -344,6 +365,7 @@ class TestTrainStepTinyModelLRReduceOnPlateau(TestTrainStepTinyModel):
self
.
loss_fn
=
loss_fn_tiny_model
self
.
train_step_func
=
train_step_tiny_model
self
.
steps
=
3
self
.
rtol
=
1e-4
class
TestTrainStepTinyModelLRCosineAnnealingDecay
(
TestTrainStepTinyModel
):
...
...
@@ -359,6 +381,7 @@ class TestTrainStepTinyModelLRCosineAnnealingDecay(TestTrainStepTinyModel):
self
.
loss_fn
=
loss_fn_tiny_model
self
.
train_step_func
=
train_step_tiny_model
self
.
steps
=
3
self
.
rtol
=
1e-4
class
TestTrainStepTinyModelLRMultiplicativeDecay
(
TestTrainStepTinyModel
):
...
...
@@ -374,6 +397,7 @@ class TestTrainStepTinyModelLRMultiplicativeDecay(TestTrainStepTinyModel):
self
.
loss_fn
=
loss_fn_tiny_model
self
.
train_step_func
=
train_step_tiny_model
self
.
steps
=
3
self
.
rtol
=
1e-4
class
TestTrainStepTinyModelLROneCycleLR
(
TestTrainStepTinyModel
):
...
...
@@ -387,6 +411,7 @@ class TestTrainStepTinyModelLROneCycleLR(TestTrainStepTinyModel):
self
.
loss_fn
=
loss_fn_tiny_model
self
.
train_step_func
=
train_step_tiny_model
self
.
steps
=
3
self
.
rtol
=
1e-4
class
TestTrainStepTinyModelLRCyclicLR
(
TestTrainStepTinyModel
):
...
...
@@ -404,6 +429,7 @@ class TestTrainStepTinyModelLRCyclicLR(TestTrainStepTinyModel):
self
.
loss_fn
=
loss_fn_tiny_model
self
.
train_step_func
=
train_step_tiny_model
self
.
steps
=
3
self
.
rtol
=
1e-4
if
__name__
==
"__main__"
:
...
...
test/dygraph_to_static/test_train_step_resnet18_adam.py
浏览文件 @
d2939cab
...
...
@@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import
platform
import
unittest
from
test_train_step
import
(
...
...
@@ -33,6 +34,9 @@ class TestTrainStepResNet18Adam(TestTrainStepTinyModel):
self
.
loss_fn
=
loss_fn_tiny_model
self
.
train_step_func
=
train_step_tiny_model
self
.
steps
=
3
self
.
rtol
=
1e-4
if
platform
.
system
()
==
'Windows'
:
self
.
rtol
=
1e-3
if
__name__
==
"__main__"
:
...
...
test/dygraph_to_static/test_train_step_resnet18_sgd.py
浏览文件 @
d2939cab
...
...
@@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import
platform
import
unittest
from
test_train_step
import
(
...
...
@@ -33,6 +34,9 @@ class TestTrainStepResNet18Sgd(TestTrainStepTinyModel):
self
.
loss_fn
=
loss_fn_tiny_model
self
.
train_step_func
=
train_step_tiny_model
self
.
steps
=
3
self
.
rtol
=
1e-4
if
platform
.
system
()
==
'Windows'
:
self
.
rtol
=
1e-3
if
__name__
==
"__main__"
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录