Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MegEngine 天元
MegEngine
提交
2c5a007a
MegEngine
项目概览
MegEngine 天元
/
MegEngine
1 年多 前同步成功
通知
403
Star
4705
Fork
582
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
MegEngine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
2c5a007a
编写于
10月 18, 2021
作者:
M
Megvii Engine Team
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(mge/optimizer): allow lr to be 0
GitOrigin-RevId: dabd1fcc3390787988553abded8c572bfccf1957
上级
c50858ee
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
8 addition
and
14 deletion
+8
-14
imperative/python/megengine/optimizer/adadelta.py
imperative/python/megengine/optimizer/adadelta.py
+1
-1
imperative/python/megengine/optimizer/adagrad.py
imperative/python/megengine/optimizer/adagrad.py
+1
-1
imperative/python/megengine/optimizer/adam.py
imperative/python/megengine/optimizer/adam.py
+1
-1
imperative/python/megengine/optimizer/adamw.py
imperative/python/megengine/optimizer/adamw.py
+1
-1
imperative/python/megengine/optimizer/sgd.py
imperative/python/megengine/optimizer/sgd.py
+4
-4
imperative/python/test/integration/test_trace_dump.py
imperative/python/test/integration/test_trace_dump.py
+0
-6
未找到文件。
imperative/python/megengine/optimizer/adadelta.py
浏览文件 @
2c5a007a
...
...
@@ -63,7 +63,7 @@ class Adadelta(Optimizer):
eps
=
param_group
[
"eps"
]
def
make_scalar
(
val
):
return
tensor
(
val
)
return
tensor
(
val
,
dtype
=
"float32"
)
# since `conver_inputs` is disabled for param updates,
# scalar should be explicitly tansforred to tensor
...
...
imperative/python/megengine/optimizer/adagrad.py
浏览文件 @
2c5a007a
...
...
@@ -62,7 +62,7 @@ class Adagrad(Optimizer):
eps
=
param_group
[
"eps"
]
def
make_scalar
(
val
):
return
tensor
(
val
)
return
tensor
(
val
,
dtype
=
"float32"
)
# since `conver_inputs` is disabled for param updates,
# scalar should be explicitly tansforred to tensor
...
...
imperative/python/megengine/optimizer/adam.py
浏览文件 @
2c5a007a
...
...
@@ -61,7 +61,7 @@ class Adam(Optimizer):
beta0
,
beta1
=
param_group
[
"betas"
]
def
make_scalar
(
val
):
return
tensor
(
val
)
return
tensor
(
val
,
dtype
=
"float32"
)
# since `conver_inputs` is disabled for param updates,
# scalar should be explicitly tansforred to tensor
...
...
imperative/python/megengine/optimizer/adamw.py
浏览文件 @
2c5a007a
...
...
@@ -61,7 +61,7 @@ class AdamW(Optimizer):
beta0
,
beta1
=
param_group
[
"betas"
]
def
make_scalar
(
val
):
return
tensor
(
val
)
return
tensor
(
val
,
dtype
=
"float32"
)
# since `conver_inputs` is disabled for param updates,
# scalar should be explicitly tansforred to tensor
...
...
imperative/python/megengine/optimizer/sgd.py
浏览文件 @
2c5a007a
...
...
@@ -62,13 +62,13 @@ class SGD(Optimizer):
# since `conver_inputs` is disabled for param updates,
# scalar should be explicitly tansforred to tensor
_lr
=
tensor
(
lr
)
_weight_decay
=
tensor
(
weight_decay
)
_momentum
=
tensor
(
momentum
)
_lr
=
tensor
(
lr
,
dtype
=
"float32"
)
_weight_decay
=
tensor
(
weight_decay
,
dtype
=
"float32"
)
_momentum
=
tensor
(
momentum
,
dtype
=
"float32"
)
inplace_mode
=
int
(
os
.
getenv
(
"MEGENGINE_INPLACE_UPDATE"
,
"0"
))
if
inplace_mode
:
_neg_lr
=
tensor
(
-
lr
)
_neg_lr
=
tensor
(
-
lr
,
dtype
=
"float32"
)
c1
=
tensor
([
1.0
])
for
param
in
param_group
[
"params"
]:
...
...
imperative/python/test/integration/test_trace_dump.py
浏览文件 @
2c5a007a
...
...
@@ -133,12 +133,6 @@ def test_xornet_trace_dump():
data
=
tensor
(
test_data
.
astype
(
np
.
float32
))
out
=
pred_fun
(
data
)
pred_output
=
out
.
numpy
()
pred_label
=
np
.
argmax
(
pred_output
,
1
)
with
np
.
printoptions
(
precision
=
4
,
suppress
=
True
):
print
(
"Predicated probability:"
)
print
(
pred_output
)
with
mkstemp
()
as
out
:
pred_fun
.
dump
(
out
,
arg_names
=
[
"data"
],
output_names
=
[
"label"
])
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录