Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MegEngine 天元
MegEngine
提交
e9a7be46
MegEngine
项目概览
MegEngine 天元
/
MegEngine
1 年多 前同步成功
通知
404
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看板
提交
e9a7be46
编写于
1月 07, 2021
作者:
M
Megvii Engine Team
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(mgb): adapt to imperative runtime
GitOrigin-RevId: 3bccc17b6268e45f4b0f5a022be908420eb9cfc5
上级
5063a206
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
9 addition
and
5 deletion
+9
-5
imperative/python/megengine/functional/nn.py
imperative/python/megengine/functional/nn.py
+2
-0
imperative/src/impl/ops/specializations.cpp
imperative/src/impl/ops/specializations.cpp
+5
-3
src/core/include/megbrain/ir/ops.td
src/core/include/megbrain/ir/ops.td
+2
-2
未找到文件。
imperative/python/megengine/functional/nn.py
浏览文件 @
e9a7be46
...
@@ -1106,6 +1106,7 @@ def matmul(
...
@@ -1106,6 +1106,7 @@ def matmul(
transposeB
=
transpose_b
,
transposeB
=
transpose_b
,
compute_mode
=
compute_mode
,
compute_mode
=
compute_mode
,
format
=
format
,
format
=
format
,
strategy
=
get_conv_execution_strategy
(),
)
)
else
:
else
:
op
=
builtin
.
MatrixMul
(
op
=
builtin
.
MatrixMul
(
...
@@ -1113,6 +1114,7 @@ def matmul(
...
@@ -1113,6 +1114,7 @@ def matmul(
transposeB
=
transpose_b
,
transposeB
=
transpose_b
,
compute_mode
=
compute_mode
,
compute_mode
=
compute_mode
,
format
=
format
,
format
=
format
,
strategy
=
get_conv_execution_strategy
(),
)
)
(
result
,)
=
apply
(
op
,
inp1
,
inp2
)
(
result
,)
=
apply
(
op
,
inp1
,
inp2
)
...
...
imperative/src/impl/ops/specializations.cpp
浏览文件 @
e9a7be46
...
@@ -243,7 +243,8 @@ auto apply_on_var_node(
...
@@ -243,7 +243,8 @@ auto apply_on_var_node(
const
VarNodeArray
&
inputs
)
{
const
VarNodeArray
&
inputs
)
{
auto
&&
matmul
=
static_cast
<
const
MatrixMul
&>
(
def
);
auto
&&
matmul
=
static_cast
<
const
MatrixMul
&>
(
def
);
mgb_assert
(
inputs
.
size
()
==
2
);
mgb_assert
(
inputs
.
size
()
==
2
);
return
opr
::
MatrixMul
::
make
(
inputs
[
0
],
inputs
[
1
],
matmul
.
param
());
return
opr
::
MatrixMul
::
make
(
inputs
[
0
],
inputs
[
1
],
matmul
.
param
(),
matmul
.
policy
());
}
}
OP_TRAIT_REG
(
MatrixMul
,
MatrixMul
)
OP_TRAIT_REG
(
MatrixMul
,
MatrixMul
)
.
apply_on_var_node
(
apply_on_var_node
)
.
apply_on_var_node
(
apply_on_var_node
)
...
@@ -256,7 +257,8 @@ auto apply_on_var_node(
...
@@ -256,7 +257,8 @@ auto apply_on_var_node(
const
VarNodeArray
&
inputs
)
{
const
VarNodeArray
&
inputs
)
{
auto
&&
matmul
=
static_cast
<
const
BatchedMatrixMul
&>
(
def
);
auto
&&
matmul
=
static_cast
<
const
BatchedMatrixMul
&>
(
def
);
mgb_assert
(
inputs
.
size
()
==
2
);
mgb_assert
(
inputs
.
size
()
==
2
);
return
opr
::
BatchedMatrixMul
::
make
(
inputs
[
0
],
inputs
[
1
],
matmul
.
param
());
return
opr
::
BatchedMatrixMul
::
make
(
inputs
[
0
],
inputs
[
1
],
matmul
.
param
(),
matmul
.
policy
());
}
}
OP_TRAIT_REG
(
BatchedMatrixMul
,
BatchedMatrixMul
)
OP_TRAIT_REG
(
BatchedMatrixMul
,
BatchedMatrixMul
)
.
apply_on_var_node
(
apply_on_var_node
)
.
apply_on_var_node
(
apply_on_var_node
)
...
@@ -428,7 +430,7 @@ auto apply_on_var_node(
...
@@ -428,7 +430,7 @@ auto apply_on_var_node(
return
opr
::
AssertEqual
::
make
(
inputs
[
0
],
inputs
[
1
],
op
.
param
());
return
opr
::
AssertEqual
::
make
(
inputs
[
0
],
inputs
[
1
],
op
.
param
());
}
}
OP_TRAIT_REG
(
AssertEqual
,
AssertEqual
)
OP_TRAIT_REG
(
AssertEqual
,
AssertEqual
)
.
apply_on_var_node
(
apply_on_var_node
)
.
apply_on_var_node
(
apply_on_var_node
)
.
fallback
();
.
fallback
();
...
...
src/core/include/megbrain/ir/ops.td
浏览文件 @
e9a7be46
...
@@ -34,9 +34,9 @@ def TypeCvt: MgbHashableOp<"TypeCvt", [], [NoSideEffect]> {
...
@@ -34,9 +34,9 @@ def TypeCvt: MgbHashableOp<"TypeCvt", [], [NoSideEffect]> {
let results = (outs AnyType);
let results = (outs AnyType);
}
}
def MatrixMul: MgbHashableOp<"MatrixMul", [MatrixMulParam]>;
def MatrixMul: MgbHashableOp<"MatrixMul", [MatrixMulParam
, ExecutionPolicyParamBase<"policy">
]>;
def BatchedMatrixMul: MgbHashableOp<"BatchedMatmul", [MatrixMulParam]>;
def BatchedMatrixMul: MgbHashableOp<"BatchedMatmul", [MatrixMulParam
, ExecutionPolicyParamBase<"policy">
]>;
def Dot: MgbHashableOp<"Dot", [EmptyParam]>;
def Dot: MgbHashableOp<"Dot", [EmptyParam]>;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录