Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MegEngine 天元
MegEngine
提交
21f5a7fc
MegEngine
项目概览
MegEngine 天元
/
MegEngine
接近 2 年 前同步成功
通知
414
Star
4708
Fork
583
代码
文件
提交
分支
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看板
提交
21f5a7fc
编写于
9月 27, 2021
作者:
M
Megvii Engine Team
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(subgraph): fix device recognition and scalar propagate
GitOrigin-RevId: fd2fe8bec9d9730e8689dbad314e54a7ecbc8bde
上级
27346b0b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
12 addition
and
14 deletion
+12
-14
imperative/python/megengine/core/tensor/utils.py
imperative/python/megengine/core/tensor/utils.py
+10
-2
imperative/python/megengine/functional/nn.py
imperative/python/megengine/functional/nn.py
+0
-1
imperative/python/megengine/functional/tensor.py
imperative/python/megengine/functional/tensor.py
+1
-10
imperative/python/src/common.cpp
imperative/python/src/common.cpp
+1
-1
未找到文件。
imperative/python/megengine/core/tensor/utils.py
浏览文件 @
21f5a7fc
...
...
@@ -230,7 +230,7 @@ for name, mode in [
def
subgraph
(
name
,
dtype
,
device
,
nr_inputs
,
gopt_level
=
None
,
jit_fusion
=
False
,
custom_grad
=
False
):
if
device
.
physical_name
.
startswith
(
"c
pu"
):
if
not
device
.
physical_name
.
startswith
(
"g
pu"
):
gopt_level
=
None
# disable jit and compile
jit_fusion
=
False
...
...
@@ -370,7 +370,15 @@ def subgraph_fn(
jit_fusion
=
jit_fusion
,
custom_grad
=
custom_grad
,
)(
func
)
return
lambda
*
args
:
apply
(
op
(),
*
args
)
def
wrapped_func
(
*
args
):
if
custom_grad
:
outputs
=
op
()(
*
args
)
else
:
outputs
=
apply
(
op
(),
*
args
)
return
outputs
return
wrapped_func
else
:
return
interpret_subgraph
(
func
,
dtype
,
device
)
...
...
imperative/python/megengine/functional/nn.py
浏览文件 @
21f5a7fc
...
...
@@ -988,7 +988,6 @@ def _get_softplus_op(dtype=None, device=None):
device
=
device
,
nr_inputs
=
1
,
jit_fusion
=
True
,
# gopt_level=0,
custom_grad
=
True
,
)
def
softplus
(
inputs
,
f
,
c
):
...
...
imperative/python/megengine/functional/tensor.py
浏览文件 @
21f5a7fc
...
...
@@ -18,14 +18,7 @@ from ..core.ops import builtin
from
..core.ops.builtin
import
Copy
,
Identity
from
..core.ops.special
import
Const
from
..core.tensor.array_method
import
_broadcast
,
_remove_axis
from
..core.tensor.utils
import
(
astensor1d
,
convert_inputs
,
get_device
,
isscalar
,
setscalar
,
subgraph_fn
,
)
from
..core.tensor.utils
import
astensor1d
,
convert_inputs
,
get_device
,
subgraph_fn
from
..device
import
get_default_device
from
..tensor
import
Tensor
from
.elemwise
import
ceil
...
...
@@ -821,8 +814,6 @@ def where(mask: Tensor, x: Tensor, y: Tensor) -> Tensor:
where
=
_get_where_op
(
dtype
=
dtype
,
device
=
device
)
(
oup
,)
=
where
(
mask
,
x
,
y
)
if
isscalar
(
mask
):
setscalar
(
oup
)
return
oup
...
...
imperative/python/src/common.cpp
浏览文件 @
21f5a7fc
...
...
@@ -67,7 +67,7 @@ void init_common(py::module m) {
[](
const
CompNode
&
cn
)
{
return
cn
.
to_string_logical
();
})
.
def_property_readonly
(
"physical_name"
,
[](
const
CompNode
&
cn
)
{
return
cn
.
to_string
();
})
[](
const
CompNode
&
cn
)
{
return
cn
.
to_string
_physical
();
})
.
def_property_readonly
(
"get_mem_status_bytes"
,
[](
const
CompNode
&
cn
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录